diff --git a/reclass/storage/mixed/__init__.py b/reclass/storage/mixed/__init__.py
new file mode 100644
index 0000000..238ce74
--- /dev/null
+++ b/reclass/storage/mixed/__init__.py
@@ -0,0 +1,58 @@
+#
+# -*- coding: utf-8 -*-
+#
+# This file is part of reclass
+
+import collections
+import copy
+
+import reclass.errors
+from reclass import get_storage
+from reclass.storage import NodeStorageBase
+
+def path_mangler(inventory_base_uri, nodes_uri, classes_uri):
+    if nodes_uri == classes_uri:
+        raise errors.DuplicateUriError(nodes_uri, classes_uri)
+    return nodes_uri, classes_uri
+
+STORAGE_NAME = 'mixed'
+
+class ExternalNodeStorage(NodeStorageBase):
+
+    MixedUri = collections.namedtuple('MixedURI', 'storage_type options')
+
+    def __init__(self, nodes_uri, classes_uri):
+        super(ExternalNodeStorage, self).__init__(STORAGE_NAME)
+
+        self._nodes_uri = self._uri(nodes_uri)
+        self._nodes_storage = get_storage(self._nodes_uri.storage_type, self._nodes_uri.options, None)
+        self._classes_default_uri = self._uri(classes_uri)
+        self._classes_default_storage = get_storage(self._classes_default_uri.storage_type, None, self._classes_default_uri.options)
+
+        self._classes_storage = dict()
+        if 'env_overrides' in classes_uri:
+            for override in classes_uri['env_overrides']:
+                for env, options in override.iteritems():
+                        uri = classes_uri
+                        uri.update(options)
+                        uri = self._uri(uri)
+                        self._classes_storage[env] = get_storage(uri.storage_type, None, uri.options)
+
+    def _uri(self, uri):
+        ret = copy.deepcopy(uri)
+        ret['storage_type'] = uri['storage_type']
+        if 'env_overrides' in ret:
+            del ret['env_overrides']
+        if uri['storage_type'] == 'yaml_fs':
+            ret = ret['uri']
+        return self.MixedUri(uri['storage_type'], ret)
+
+    def get_node(self, name):
+        return self._nodes_storage.get_node(name)
+
+    def get_class(self, name, environment=None):
+        if environment is None:
+            storage = self._classes_default_storage
+        else:
+            storage = self._classes_storage[environment]
+        return storage.get_class(name, environment=environment)
diff --git a/reclass/storage/yaml_fs/__init__.py b/reclass/storage/yaml_fs/__init__.py
index 30bfed0..d06b406 100644
--- a/reclass/storage/yaml_fs/__init__.py
+++ b/reclass/storage/yaml_fs/__init__.py
@@ -53,11 +53,13 @@
     def __init__(self, nodes_uri, classes_uri):
         super(ExternalNodeStorage, self).__init__(STORAGE_NAME)
 
-        self._nodes_uri = nodes_uri
-        self._nodes = self._enumerate_inventory(nodes_uri, NameMangler.nodes)
+        if nodes_uri is not None:
+            self._nodes_uri = nodes_uri
+            self._nodes = self._enumerate_inventory(nodes_uri, NameMangler.nodes)
 
-        self._classes_uri = classes_uri
-        self._classes = self._enumerate_inventory(classes_uri, NameMangler.classes)
+        if classes_uri is not None:
+            self._classes_uri = classes_uri
+            self._classes = self._enumerate_inventory(classes_uri, NameMangler.classes)
 
     nodes_uri = property(lambda self: self._nodes_uri)
     classes_uri = property(lambda self: self._classes_uri)
@@ -96,7 +98,7 @@
         entity = YamlData.from_file(path).get_entity(name)
         return entity
 
-    def get_class(self, name, nodename=None, environment=None):
+    def get_class(self, name, environment=None):
         vvv('GET CLASS {0}'.format(name))
         try:
             path = os.path.join(self.classes_uri, self._classes[name])
diff --git a/reclass/storage/yaml_git/__init__.py b/reclass/storage/yaml_git/__init__.py
index fdf2258..cd85ed1 100644
--- a/reclass/storage/yaml_git/__init__.py
+++ b/reclass/storage/yaml_git/__init__.py
@@ -105,25 +105,27 @@
     def __init__(self, nodes_uri, classes_uri):
         super(ExternalNodeStorage, self).__init__(STORAGE_NAME)
 
-        self._nodes_uri = GitURI({ 'branch': 'master', 'repo': None })
-        self._nodes_uri.update(nodes_uri)
-        self._load_repo(self._nodes_uri.repo)
-        self._nodes = self._repos[self._nodes_uri.repo].nodes(self._nodes_uri.branch)
+        if nodes_uri is not None:
+            self._nodes_uri = GitURI({ 'branch': 'master', 'repo': None })
+            self._nodes_uri.update(nodes_uri)
+            self._load_repo(self._nodes_uri.repo)
+            self._nodes = self._repos[self._nodes_uri.repo].nodes(self._nodes_uri.branch)
 
-        self._classes_default_uri = GitURI({ 'branch': '__env__', 'repo': None })
-        self._classes_default_uri.update(classes_uri)
-        self._load_repo(self._classes_default_uri.repo)
+        if classes_uri is not None:
+            self._classes_default_uri = GitURI({ 'branch': '__env__', 'repo': None })
+            self._classes_default_uri.update(classes_uri)
+            self._load_repo(self._classes_default_uri.repo)
 
-        self._classes_uri = []
-        if 'env_overrides' in classes_uri:
-            for override in classes_uri['env_overrides']:
-                for env, options in override.iteritems():
-                    uri = GitURI({ 'branch': env, 'repo': self._classes_default_uri.repo })
-                    uri.update(options)
-                    self._classes_uri.append((env, uri))
-                    self._load_repo(uri.repo)
+            self._classes_uri = []
+            if 'env_overrides' in classes_uri:
+                for override in classes_uri['env_overrides']:
+                    for env, options in override.iteritems():
+                        uri = GitURI({ 'branch': env, 'repo': self._classes_default_uri.repo })
+                        uri.update(options)
+                        self._classes_uri.append((env, uri))
+                        self._load_repo(uri.repo)
 
-        self._classes_uri.append(('*', self._classes_default_uri))
+            self._classes_uri.append(('*', self._classes_default_uri))
 
     nodes_uri = property(lambda self: self._nodes_uri)
     classes_uri = property(lambda self: self._classes_uri)
@@ -134,7 +136,7 @@
         entity = YamlData.from_string(blob.data, 'git_fs://{0}#{1}/{2}'.format(self._nodes_uri.repo, self._nodes_uri.branch, file.path)).get_entity(name)
         return entity
 
-    def get_class(self, name, nodename=None, environment=None):
+    def get_class(self, name, environment=None):
         uri = self._env_to_uri(environment)
         file = self._repos[uri.repo].files[uri.branch][name]
         blob = self._repos[uri.repo].get(file.id)
