Index: code/branches/core2/src/orxonox/core/ClassTreeMask.cc
===================================================================
--- code/branches/core2/src/orxonox/core/ClassTreeMask.cc	(revision 895)
+++ code/branches/core2/src/orxonox/core/ClassTreeMask.cc	(revision 896)
@@ -561,4 +561,37 @@
 
     /**
+        @brief Compares the mask with another mask and returns true if they represent the same logic.
+        @param other The other mask
+        @return True if both masks represent the same logic
+    */
+    bool ClassTreeMask::operator==(const ClassTreeMask& other) const
+    {
+        ClassTreeMask temp1 = other;
+        ClassTreeMask temp2 = (*this);
+
+        temp1.clean();
+        temp2.clean();
+
+        ClassTreeMaskIterator it1 = temp1.root_;
+        ClassTreeMaskIterator it2 = temp2.root_;
+
+        for ( ; it1 && it2; ++it1, ++it2)
+            if (it1->getClass() != it2->getClass())
+                return false;
+
+        return true;
+    }
+
+    /**
+        @brief Compares the mask with another mask and returns true if they represent different logics.
+        @param other The other mask
+        @return True if the masks represent different logics
+    */
+    bool ClassTreeMask::operator!=(const ClassTreeMask& other) const
+    {
+        return (!((*this) == other));
+    }
+
+    /**
         @brief Prefix operator + does nothing.
         @return A reference to the mask itself
Index: code/branches/core2/src/orxonox/core/ClassTreeMask.h
===================================================================
--- code/branches/core2/src/orxonox/core/ClassTreeMask.h	(revision 895)
+++ code/branches/core2/src/orxonox/core/ClassTreeMask.h	(revision 896)
@@ -179,4 +179,7 @@
             ClassTreeMask& operator=(const ClassTreeMask& other);
 
+            bool operator==(const ClassTreeMask& other) const;
+            bool operator!=(const ClassTreeMask& other) const;
+
             ClassTreeMask& operator+();
             ClassTreeMask operator-() const;
Index: code/branches/core2/src/orxonox/core/Loader.cc
===================================================================
--- code/branches/core2/src/orxonox/core/Loader.cc	(revision 895)
+++ code/branches/core2/src/orxonox/core/Loader.cc	(revision 896)
@@ -115,25 +115,15 @@
             ticpp::Document xmlfile(level->getFile());
             xmlfile.LoadFile();
+            ticpp::Element rootElement;
+            rootElement.SetAttribute("name", "rootNamespace");
 
             for (ticpp::Iterator<ticpp::Element> child = xmlfile.FirstChildElement(false); child != child.end(); child++)
-            {
-                Identifier* identifier = ID(child->Value());
-                if (identifier)
-                {
-                    if (identifier->isA(Class(Namespace)) || Loader::currentMask_s.isIncluded(identifier))
-                    {
-                        COUT(4) << "  fabricating " << child->Value() << "..." << std::endl;
-                        BaseObject* newObject = identifier->fabricate();
-                        newObject->setLoaderIndentation("    ");
-                        newObject->setLevel(level);
-                        newObject->XMLPort(*child, true);
-                        COUT(5) << "  ...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl;
-                    }
-                }
-                else
-                {
-                    COUT(2) << "  Warning: '" << child->Value() << "' is not a valid classname." << std::endl;
-                }
-            }
+                rootElement.InsertEndChild(*child);
+
+            Namespace* rootNamespace = new Namespace();
+            rootNamespace->setLoaderIndentation("    ");
+            rootNamespace->setLevel(level);
+            rootNamespace->deleteNamespaceNodesAfterDestruction(true);
+            rootNamespace->XMLPort(rootElement, true);
 
             COUT(0) << "Finished loading " << level->getFile() << "." << std::endl;
Index: code/branches/core2/src/orxonox/core/Namespace.cc
===================================================================
--- code/branches/core2/src/orxonox/core/Namespace.cc	(revision 895)
+++ code/branches/core2/src/orxonox/core/Namespace.cc	(revision 896)
@@ -41,4 +41,5 @@
 
         this->bAutogeneratedFileRootNamespace_ = false;
+        this->bDeleteNamespaceNodesAfterDestruction_ = false;
         this->operator_ = "or";
     }
@@ -46,4 +47,7 @@
     Namespace::~Namespace()
     {
+        if (this->bDeleteNamespaceNodesAfterDestruction_)
+            for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
+                delete (*it);
     }
 
Index: code/branches/core2/src/orxonox/core/Namespace.h
===================================================================
--- code/branches/core2/src/orxonox/core/Namespace.h	(revision 895)
+++ code/branches/core2/src/orxonox/core/Namespace.h	(revision 896)
@@ -62,7 +62,11 @@
             bool isIncludedIn(const Namespace* ns) const { return ns->includes(this); }
 
+            void deleteNamespaceNodesAfterDestruction(bool bDelete)
+                { this->bDeleteNamespaceNodesAfterDestruction_ = bDelete; }
+
         private:
             std::set<NamespaceNode*> representingNamespaces_;
             bool bAutogeneratedFileRootNamespace_;
+            bool bDeleteNamespaceNodesAfterDestruction_;
             std::string operator_;
     };
