Index: code/branches/core/src/orxonox/core/ClassManager.h
===================================================================
--- code/branches/core/src/orxonox/core/ClassManager.h	(revision 808)
+++ code/branches/core/src/orxonox/core/ClassManager.h	(revision 809)
@@ -26,4 +26,17 @@
  */
 
+/*!
+    @file ClassManager.h
+    @brief Definition and Implementation of the ClassManager template.
+
+    The ClassManager is a helper-class for ClassIdentifier. Because ClassIdentifiers must
+    be unique, they are created through the IdentifierDistributor-class to assure the
+    uniqueness of the ClassIdentifier. But accessing Identifiers through IdentifierDistributor
+    is slow, because it uses strings and a map. Thats why we use the ClassManager-template: It's
+    a singleton like ClassIdentifier, but it doesn't hurt if there are multiple instances in
+    different libraries, because they all store the same pointer to the unique ClassIdentifier
+    which they've retrieved through IdentifierDistributor.
+*/
+
 #ifndef _ClassManager_H__
 #define _ClassManager_H__
@@ -38,4 +51,11 @@
 namespace orxonox
 {
+    //! ClassManager is a helper class to allow faster access on the ClassIdentifiers.
+    /**
+        Because accessing the IdentifierDistributor is slow, the ClassManager accesses it once
+        and stores the result in a member-variable. IdentifierDistributor assures the uniqueness
+        of the ClassIdentifier, even if there are multiple instances of the ClassManager-template
+        in different libraries.
+    */
     template <class T>
     class ClassManager
@@ -51,6 +71,6 @@
             ~ClassManager() {}                                       // don't delete
 
-            bool bInitialized_;
-            ClassIdentifier<T>* identifier_;
+            bool bInitialized_;                 //!< This is false until the ClassIdentifier gets assigned
+            ClassIdentifier<T>* identifier_;    //!< The unique ClassIdentifier for the class T
     };
 
@@ -82,15 +102,24 @@
     ClassIdentifier<T>* ClassManager<T>::getIdentifier(const std::string& name)
     {
+        // Check if the ClassManager is already initialized
         if (!ClassManager<T>::getSingleton()->bInitialized_)
         {
+            // It's not -> retrieve the ClassIdentifier through IdentifierDistributor
+            COUT(4) << "*** Create Identifier Singleton." << std::endl;
 
-            COUT(4) << "*** Create Identifier Singleton." << std::endl;
+            // First create a ClassIdentifier in case there's no instance existing yet
             ClassIdentifier<T>* temp = new ClassIdentifier<T>();
+
+            // Ask the IdentifierDistributor for the unique ClassIdentifier
             ClassManager<T>::getSingleton()->identifier_ = (ClassIdentifier<T>*)IdentifierDistributor::getIdentifier(name, temp);
+
+            // If the retrieved Identifier differs from our proposal, we don't need the proposal any more
             if (temp != ClassManager<T>::getSingleton()->identifier_)
                 delete temp;
+
             ClassManager<T>::getSingleton()->bInitialized_ = true;
         }
 
+        // Finally return the unique ClassIdentifier
         return ClassManager<T>::getSingleton()->identifier_;
     }
Index: code/branches/core/src/orxonox/core/ClassTreeMask.cc
===================================================================
--- code/branches/core/src/orxonox/core/ClassTreeMask.cc	(revision 808)
+++ code/branches/core/src/orxonox/core/ClassTreeMask.cc	(revision 809)
@@ -26,4 +26,9 @@
  */
 
+/*!
+    @file ClassTreeMask.cc
+    @brief Implementation of the ClassTreeMask, ClassTreeMaskNode and ClassTreeMaskIterator classes.
+*/
+
 #include "ClassTreeMask.h"
 #include "Identifier.h"
@@ -35,4 +40,9 @@
     // ###    ClassTreeMaskNode    ###
     // ###############################
+    /**
+        @brief Constructor: Creates the node, sets the subclass and the rule.
+        @param subclass The subclass the rule refers to
+        @param bIncluded The rule: included (true) or excluded (false)
+    */
     ClassTreeMaskNode::ClassTreeMaskNode(const Identifier* subclass, bool bIncluded)
     {
@@ -41,10 +51,17 @@
     }
 
+    /**
+        @brief Destructor: Deletes all subnodes.
+    */
     ClassTreeMaskNode::~ClassTreeMaskNode()
     {
+        // Go through the list of all subnodes and delete them
         for (std::list<ClassTreeMaskNode*>::iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); )
             delete (*(it++));
     }
 
+    /**
+        @brief Sets the rule for the node to "included".
+    */
     void ClassTreeMaskNode::include()
     {
@@ -52,4 +69,7 @@
     }
 
+    /**
+        @brief Sets the rule for the node to "excluded".
+    */
     void ClassTreeMaskNode::exclude()
     {
@@ -57,4 +77,8 @@
     }
 
+    /**
+        @brief Sets the rule for the node to a given value.
+        @param bIncluded The rule: included (true) or excluded (false)
+    */
     void ClassTreeMaskNode::setIncluded(bool bIncluded)
     {
@@ -62,4 +86,8 @@
     }
 
+    /**
+        @brief Adds a new subnode to the list of subnodes.
+        @param subnode The new subnode
+    */
     void ClassTreeMaskNode::addSubnode(ClassTreeMaskNode* subnode)
     {
@@ -67,4 +95,8 @@
     }
 
+    /**
+        @brief Tells if the rule is "included" or not.
+        @return The rule: true = included, false = excluded
+    */
     bool ClassTreeMaskNode::isIncluded() const
     {
@@ -72,4 +104,8 @@
     }
 
+    /**
+        @brief Tells if the rule is "excluded" or not.
+        @return The inverted rule: true = excluded, false = included
+    */
     bool ClassTreeMaskNode::isExcluded() const
     {
@@ -77,4 +113,8 @@
     }
 
+    /**
+        @brief Returns the Identifier of the class the rule refers to.
+        @return The Identifier representing the class
+    */
     const Identifier* ClassTreeMaskNode::getClass() const
     {
@@ -86,36 +126,67 @@
     // ###  ClassTreeMaskIterator  ###
     // ###############################
+    /**
+        @brief Constructor: Initializes the iterator by creating a helper-list with the root-node and putting it to the stack.
+        @param node The root-node
+    */
     ClassTreeMaskIterator::ClassTreeMaskIterator(ClassTreeMaskNode* node)
     {
+        // Create a list and put the root-note into it
         std::list<ClassTreeMaskNode*>::iterator it = this->rootlist_.insert(this->rootlist_.end(), node);
+
+        // Put the iterator to the only element of the list and the corresponding end()-iterator on the stack
         this->nodes_.push(std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator>(it, this->rootlist_.end()));
     }
 
+    /**
+        @brief Destructor: Does nothing.
+    */
     ClassTreeMaskIterator::~ClassTreeMaskIterator()
     {
     }
 
+    /**
+        @brief Iterates through the rule-tree.
+        @return A reference to the iterator itself
+    */
     ClassTreeMaskIterator& ClassTreeMaskIterator::operator++()
     {
+        // Check if the actual node has subnodes
         if ((*this->nodes_.top().first)->subnodes_.begin() != (*this->nodes_.top().first)->subnodes_.end())
+        {
+            // Yes it has: Push an iterator, pointing at the first subnode, on the stack
             this->nodes_.push(std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator>((*this->nodes_.top().first)->subnodes_.begin(), (*this->nodes_.top().first)->subnodes_.end()));
+        }
         else
         {
+            // No subnodes, meaning we reached a leaf: Go to the next node
             do
             {
+                // Iterate one step in the current list
                 ++this->nodes_.top().first;
+
+                // Check if we reached the end of the list (the second item in the stored pair always represents the end)
                 if (this->nodes_.top().first == this->nodes_.top().second)
                 {
+                    // Yes we've reached the end: Pop the list-iterator from the stack
                     this->nodes_.pop();
+
+                    // Continue with the loop, meaning: Try to iterate through the previous list
                     continue;
                 }
 
+                // If we reached this point, we aren't yet at the end of the list: Leave the loop
                 break;
-            } while (!this->nodes_.empty());
-        }
-
+            } while (!this->nodes_.empty()); // Stop looping if the stack is empty, meaning: We've iterated to the end
+        }
+
+        // Finally return a reference to the iterator itself
         return *this;
     }
 
+    /**
+        @brief Returns a pointer to the ClassTreeMaskNode whereon the iterator points.
+        @return The pointer to the node
+    */
     ClassTreeMaskNode* ClassTreeMaskIterator::operator*() const
     {
@@ -123,4 +194,8 @@
     }
 
+    /**
+        @brief Returns a pointer to the ClassTreeMaskNode whereon the iterator points.
+        @return The pointer to the node
+    */
     ClassTreeMaskNode* ClassTreeMaskIterator::operator->() const
     {
@@ -128,4 +203,8 @@
     }
 
+    /**
+        @brief Returns true if the stack is empty, meaning we've reached the end of the tree.
+        @return True if we've reached the end of the tree
+    */
     ClassTreeMaskIterator::operator bool()
     {
@@ -133,4 +212,9 @@
     }
 
+    /**
+        @brief Compares the current node with the given one and returns true if they match.
+        @param compare The node to compare with
+        @return The result of the comparison (true if they match)
+    */
     bool ClassTreeMaskIterator::operator==(ClassTreeMaskNode* compare)
     {
@@ -141,4 +225,9 @@
     }
 
+    /**
+        @brief Compares the current node with the given one and returns true if they don't match.
+        @param compare The node to compare with
+        @return The result of the comparison (true if they don't match)
+    */
     bool ClassTreeMaskIterator::operator!=(ClassTreeMaskNode* compare)
     {
@@ -153,4 +242,7 @@
     // ###      ClassTreeMask      ###
     // ###############################
+    /**
+        @brief Constructor: Adds the root-node of the tree with the first rule ("include everything").
+    */
     ClassTreeMask::ClassTreeMask()
     {
@@ -158,4 +250,8 @@
     }
 
+    /**
+        @brief Copyconstructor: Adds the root-node of the tree with the first rule ("include everything") and adds all rules from the other mask.
+        @param other The other mask
+    */
     ClassTreeMask::ClassTreeMask(const ClassTreeMask& other)
     {
@@ -165,4 +261,7 @@
     }
 
+    /**
+        @brief Destructor: Deletes the root node (which will delete all subnodes too).
+    */
     ClassTreeMask::~ClassTreeMask()
     {
@@ -170,4 +269,8 @@
     }
 
+    /**
+        @brief Adds a new "include" rule for a given subclass to the mask.
+        @param subclass The subclass
+    */
     void ClassTreeMask::include(const Identifier* subclass)
     {
@@ -175,4 +278,8 @@
     }
 
+    /**
+        @brief Adds a new "exclude" rule for a given subclass to the mask.
+        @param subclass The subclass
+    */
     void ClassTreeMask::exclude(const Identifier* subclass)
     {
@@ -180,4 +287,9 @@
     }
 
+    /**
+        @brief Adds a new rule for a given subclass to the mask.
+        @param subclass The subclass
+        @param bInclude The rule: include (true) or exclude (false)
+    */
     void ClassTreeMask::add(const Identifier* subclass, bool bInclude)
     {
@@ -185,4 +297,10 @@
     }
 
+    /**
+        @brief Adds a new rule for a given subclass to a node of the internal rule-tree (recursive function).
+        @param node The node
+        @param subclass The subclass
+        @param bInclude The rule: include (true) or exclude (false)
+    */
     void ClassTreeMask::add(ClassTreeMaskNode* node, const Identifier* subclass, bool bInclude)
     {
@@ -201,5 +319,5 @@
                 if (subclass->isA((*it)->getClass()))
                 {
-                    // We've found an existing node -> delegate the work and return
+                    // We've found an existing node -> delegate the work with a recursive function-call and return
                     this->add(*it, subclass, bInclude);
                     return;
@@ -230,4 +348,7 @@
     }
 
+    /**
+        @brief Resets the mask to "include everything".
+    */
     void ClassTreeMask::reset()
     {
@@ -236,4 +357,9 @@
     }
 
+    /**
+        @brief Tells if a given subclass is included or not.
+        @param subclass The subclass
+        @return Included (true) or excluded (false)
+    */
     bool ClassTreeMask::isIncluded(const Identifier* subclass) const
     {
@@ -241,7 +367,12 @@
     }
 
+    /**
+        @brief Tells if a given subclass of a node in the rule-tree is included or not (recursive function).
+        @param node The node
+        @param subclass The subclass
+        @return Included (true) or excluded (false)
+    */
     bool ClassTreeMask::isIncluded(ClassTreeMaskNode* node, const Identifier* subclass) const
     {
-//std::cout << "1_1: " << subclass->getName() << " (" << subclass << ") / " << node->getClass()->getName() << " (" << node->getClass() << ")" << std::endl;
         // Check if the searched subclass is of the same type as the class in the current node or a derivative
         if (subclass->isA(node->getClass()))
@@ -251,5 +382,5 @@
                 return node->isIncluded();
 
-            // Go through the list of subnodes and look for a node containing the searched subclass
+            // Go through the list of subnodes and look for a node containing the searched subclass and delegate the request by a recursive function-call.
             for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
                 if (subclass->isA((*it)->getClass()))
@@ -266,4 +397,9 @@
     }
 
+    /**
+        @brief Tells if a given subclass is excluded or not.
+        @param subclass The subclass
+        @return The inverted rule: Excluded (true) or included (false)
+    */
     bool ClassTreeMask::isExcluded(const Identifier* subclass) const
     {
@@ -271,4 +407,7 @@
     }
 
+    /**
+        @brief Removes all unneeded rules that don't change the information of the mask.
+    */
     void ClassTreeMask::clean()
     {
@@ -276,42 +415,59 @@
     }
 
+    /**
+        @brief Removes all unneded rules that don't change the information of a node of a mask (recursive function).
+        @param node The node
+    */
     void ClassTreeMask::clean(ClassTreeMaskNode* node)
     {
-//std::cout << "4_1: " << node->getClass()->getName() << ": " << node->isIncluded() << "\n";
+        // Iterate through all subnodes of the given node
         for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); )
         {
-//std::cout << "4_2: " << (*it)->getClass()->getName() << ": " << (*it)->isIncluded() << "\n";
+            // Recursive function-call: Clean the subnode
             this->clean(*it);
-//std::cout << "4_3\n";
+
+            // Now check if the subnode contains the same rule as the current node
             if ((*it)->isIncluded() == node->isIncluded())
             {
-//std::cout << "4_4\n";
+                // It does: Move all subnodes of the redundant subnode to the current node
                 node->subnodes_.insert(node->subnodes_.end(), (*it)->subnodes_.begin(), (*it)->subnodes_.end());
                 (*it)->subnodes_.clear();
-                node->subnodes_.erase(it);
-                it = node->subnodes_.begin();
-//std::cout << "4_5\n";
+
+                // Remove the redundant subnode from the current node
+                node->subnodes_.erase(it++);
             }
             else
             {
-//std::cout << "4_6\n";
+                // The subnode is necessary: Move on to the next subnode
                 ++it;
             }
         }
-//std::cout << "4_7\n";
-    }
-
+    }
+
+    /**
+        @brief Assignment operator: Adds all rules of the other mask.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
     ClassTreeMask& ClassTreeMask::operator=(const ClassTreeMask& other)
     {
+        // Make a copy to avoid troubles with self-assignments (like A = A).
         ClassTreeMask temp(other);
 
+        // Removes all current rules
         this->reset();
 
+        // Copy all rules from the other mask
         for (ClassTreeMaskIterator it = temp.root_; it; ++it)
             this->add(it->getClass(), it->isIncluded());
 
+        // Return a reference to the mask itself
         return (*this);
     }
 
+    /**
+        @brief Prefix operator + does nothing.
+        @return A reference to the mask itself
+    */
     ClassTreeMask& ClassTreeMask::operator+()
     {
@@ -319,4 +475,8 @@
     }
 
+    /**
+        @brief Prefix operator - inverts the mask.
+        @return The inverted mask
+    */
     ClassTreeMask ClassTreeMask::operator-() const
     {
@@ -324,7 +484,15 @@
     }
 
+    /**
+        @brief Adds two masks in the sense of a union (all classes that are included in at least one of the masks will be included in the resulting mask too).
+        @param other The mask to unite with
+        @return The union
+    */
     ClassTreeMask ClassTreeMask::operator+(const ClassTreeMask& other) const
     {
+        // Create a new mask
         ClassTreeMask newmask;
+
+        // Add all nodes from the first mask, calculate the rule with the or-operation
         for (ClassTreeMaskIterator it = this->root_; it; ++it)
         {
@@ -332,4 +500,6 @@
             newmask.add(subclass, this->isIncluded(subclass) or other.isIncluded(subclass));
         }
+
+        // Add all nodes from the second mask, calculate the rule with the or-operation
         for (ClassTreeMaskIterator it = other.root_; it; ++it)
         {
@@ -337,12 +507,23 @@
             newmask.add(subclass, this->isIncluded(subclass) or other.isIncluded(subclass));
         }
+
+        // Drop all redundant rules
         newmask.clean();
 
+        // Return the new mask
         return newmask;
     }
 
+    /**
+        @brief Intersects two masks (only classes that are included in both masks will be included in the resulting mask too).
+        @param other The mask to intersect with
+        @return The intersection
+    */
     ClassTreeMask ClassTreeMask::operator*(const ClassTreeMask& other) const
     {
+        // Create a new mask
         ClassTreeMask newmask;
+
+        // Add all nodes from the first mask, calculate the rule with the and-operation
         for (ClassTreeMaskIterator it = this->root_; it; ++it)
         {
@@ -350,4 +531,6 @@
             newmask.add(subclass, this->isIncluded(subclass) and other.isIncluded(subclass));
         }
+
+        // Add all nodes from the second mask, calculate the rule with the and-operation
         for (ClassTreeMaskIterator it = other.root_; it; ++it)
         {
@@ -355,9 +538,17 @@
             newmask.add(subclass, this->isIncluded(subclass) and other.isIncluded(subclass));
         }
+
+        // Drop all redundant rules
         newmask.clean();
 
+        // Return the new mask
         return newmask;
     }
 
+    /**
+        @brief Removes all elements of the second mask from the first mask (all classes that are included in the first mask stay included, except those that are included in the second mask too).
+        @param other The mask to subtract.
+        @return The difference
+    */
     ClassTreeMask ClassTreeMask::operator-(const ClassTreeMask& other) const
     {
@@ -365,7 +556,14 @@
     }
 
+    /**
+        @brief Inverts the mask (all included classes are now excluded and vice versa).
+        @return The complement
+    */
     ClassTreeMask ClassTreeMask::operator!() const
     {
+        // Create a new mask
         ClassTreeMask newmask;
+
+        // Add all nodes from the other mask, inverting the rules
         for (ClassTreeMaskIterator it = this->root_; it; ++it)
         {
@@ -373,7 +571,14 @@
             newmask.add(subclass, !this->isIncluded(subclass));
         }
+
+        // Return the new mask
         return newmask;
     }
 
+    /**
+        @brief Unites this mask with another mask.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
     ClassTreeMask& ClassTreeMask::operator+=(const ClassTreeMask& other)
     {
@@ -382,4 +587,9 @@
     }
 
+    /**
+        @brief Intersects this mask with another mask.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
     ClassTreeMask& ClassTreeMask::operator*=(const ClassTreeMask& other)
     {
@@ -388,4 +598,9 @@
     }
 
+    /**
+        @brief Subtracts another mask from this mask.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
     ClassTreeMask& ClassTreeMask::operator-=(const ClassTreeMask& other)
     {
@@ -394,4 +609,9 @@
     }
 
+    /**
+        @brief Intersects two masks (only classes that are included in both masks will be included in the resulting mask too).
+        @param other The mask to intersect with
+        @return The intersection
+    */
     ClassTreeMask ClassTreeMask::operator&(const ClassTreeMask& other) const
     {
@@ -399,4 +619,9 @@
     }
 
+    /**
+        @brief Adds two masks in the sense of a union (all classes that are included in at least one of the masks will be included in the resulting mask too).
+        @param other The mask to unite with
+        @return The union
+    */
     ClassTreeMask ClassTreeMask::operator|(const ClassTreeMask& other) const
     {
@@ -404,7 +629,15 @@
     }
 
+    /**
+        @brief Joins two masks in the sense of a xor (exclusivity) operation (all classes that are included in exactly one of the masks, but not in both, will be included in the resulting mask too).
+        @param other The mask to join with
+        @return The result
+    */
     ClassTreeMask ClassTreeMask::operator^(const ClassTreeMask& other) const
     {
+        // Create a new mask
         ClassTreeMask newmask;
+
+        // Add all nodes from the first mask, calculate the rule with the xor-operation
         for (ClassTreeMaskIterator it = this->root_; it; ++it)
         {
@@ -412,4 +645,6 @@
             newmask.add(subclass, this->isIncluded(subclass) xor other.isIncluded(subclass));
         }
+
+        // Add all nodes from the second mask, calculate the rule with the xor-operation
         for (ClassTreeMaskIterator it = other.root_; it; ++it)
         {
@@ -417,9 +652,16 @@
             newmask.add(subclass, this->isIncluded(subclass) xor other.isIncluded(subclass));
         }
+
+        // Drop all redundant rules
         newmask.clean();
 
+        // Return the new mask
         return newmask;
     }
 
+    /**
+        @brief Inverts the mask (all included classes are now excluded and vice versa).
+        @return The complement
+    */
     ClassTreeMask ClassTreeMask::operator~() const
     {
@@ -427,4 +669,9 @@
     }
 
+    /**
+        @brief Intersects this mask with another mask (and-operation)
+        @param other The other mask
+        @return A reference to the mask itself
+    */
     ClassTreeMask& ClassTreeMask::operator&=(const ClassTreeMask& other)
     {
@@ -433,4 +680,9 @@
     }
 
+    /**
+        @brief Unites this mask with another mask (or-operation).
+        @param other The other mask
+        @return A reference to the mask itself
+    */
     ClassTreeMask& ClassTreeMask::operator|=(const ClassTreeMask& other)
     {
@@ -439,4 +691,9 @@
     }
 
+    /**
+        @brief Joins this mask with another mask with a xor-operation.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
     ClassTreeMask& ClassTreeMask::operator^=(const ClassTreeMask& other)
     {
@@ -445,8 +702,16 @@
     }
 
+    /**
+        @brief Converts the content of a mask into a human readable string and puts it on the ostream.
+        @param out The ostream
+        @param mask The mask
+        @return A reference to the ostream
+    */
     std::ostream& operator<<(std::ostream& out, const ClassTreeMask& mask)
     {
+        // Iterate through all rules
         for (ClassTreeMaskIterator it = mask.root_; it; ++it)
         {
+            // Calculate the prefix: + means included, - means excluded
             if (it->isIncluded())
                 out << "+";
@@ -454,4 +719,5 @@
                 out << "-";
 
+            // Put the name of the corresponding class on the stream
             out << it->getClass()->getName() << " ";
         }
Index: code/branches/core/src/orxonox/core/ClassTreeMask.h
===================================================================
--- code/branches/core/src/orxonox/core/ClassTreeMask.h	(revision 808)
+++ code/branches/core/src/orxonox/core/ClassTreeMask.h	(revision 809)
@@ -26,4 +26,41 @@
  */
 
+/*!
+    @file ClassTreeMask.h
+    @brief Definition of the ClassTreeMask, ClassTreeMaskNode and ClassTreeMaskIterator classes.
+
+    ClassTreeMask is a class to define a mask of the class-tree beginning with BaseObject.
+    You can include or exclude classes by calling the corresponding functions with the
+    Identifier of the class.
+
+    You can work with a ClassTreeMask in the sense of the set theory, meaning that you can create
+    unions, intersections, complements and differences by using overloaded operators.
+
+    The ClassTreeMask is internally represented by a tree. The nodes in the tree are
+    ClassTreeMaskNodes, containing the rule (included or excluded) for this class and all
+    subclasses and a list of all subnodes. To minimize the size, the tree contains only
+    nodes changing the mask. By adding new rules, the tree gets reordered dynamically.
+
+    You can manually add useless rules and they stay in the tree. That way you can add rules in
+    any order without changing information of the resulting mask. Example: A new mask includes all
+    classes. Now you explicitly include a subclass. This seems to be useless. But if you exclude a
+    baseclass of the formerly included subclass, the subclass stays included. You could create the
+    same mask by first excluding the baseclass and then including the subclass. You can drop
+    useless rules from the tree by calling clean().
+
+    Because of the complicated shape of the internal tree, there is an iterator to iterate
+    through all ClassTreeMaskNodes of a mask. It starts with the BaseObject and moves on to
+    the first subclass until it reaches a leaf of the tree. Then the iterator moves one step
+    back and iterates to the second subclass. If there are no more subclasses, it steps another
+    step back, and so on.
+
+    Example: A and B are childs of BaseObject, A1 and A2 are childs of A, B1 and B2 are childs of B.
+    The ClassTreeMaskIterator would move trough the tree in the following order:
+    BaseObject, A, A1, A2, B, B1, B2.
+
+    Note that the iterator doesn't move trough the whole class-tree, but only through the
+    internal tree of the mask, containing the minimal needed set of nodes to describe the mask.
+*/
+
 #ifndef _ClassTreeMask_H__
 #define _ClassTreeMask_H__
@@ -36,4 +73,13 @@
 namespace orxonox
 {
+    // ###############################
+    // ###    ClassTreeMaskNode    ###
+    // ###############################
+    //! The ClassTreeMaskNode is a node in the internal tree of the ClassTreeMask, containing the rules of the mask.
+    /**
+        The ClassTreeMaskNode is used to store the rule (included or excluded) for a given
+        class (described by the corresponding Identifier). The nodes are used in the internal
+        tree of ClassTreeMask. To build a tree, they store a list of all subnodes.
+    */
     class ClassTreeMaskNode
     {
@@ -57,9 +103,21 @@
 
         private:
-            const Identifier* subclass_;
-            bool bIncluded_;
-            std::list<ClassTreeMaskNode*> subnodes_;
+            const Identifier* subclass_;                //!< The Identifier of the subclass the rule refers to
+            bool bIncluded_;                            //!< The rule: included or excluded
+            std::list<ClassTreeMaskNode*> subnodes_;    //!< A list containing all subnodes in the tree
     };
 
+
+    // ###############################
+    // ###  ClassTreeMaskIterator  ###
+    // ###############################
+    //! The ClassTreeMaskIterator moves through all ClassTreeMaskNodes of the internal tree of a ClassTreeMask, containing the rules.
+    /**
+        Because of the complicated shape of the internal rule-tree of ClassTreeMask, an
+        iterator is used to move through all nodes of the tree. It starts with the BaseObject
+        and moves on to the first subclass until it reaches a leaf of the tree. Then the
+        iterator moves one step back and iterates to the second subclass. If there are no more
+        subclasses, it steps another step back, and so on.
+    */
     class ClassTreeMaskIterator
     {
@@ -76,8 +134,21 @@
 
         private:
-            std::stack<std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator> > nodes_;
-            std::list<ClassTreeMaskNode*> rootlist_;
+            std::stack<std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator> > nodes_;    //!< A stack to store list-iterators
+            std::list<ClassTreeMaskNode*> rootlist_;                                                                            //!< A list for internal use (it only stores the root-node)
     };
 
+
+    // ###############################
+    // ###      ClassTreeMask      ###
+    // ###############################
+    //! The ClassTreeMask is a set of rules, containing the information for each class whether it's included or not.
+    /**
+        With a ClassTreeMask, you can include or exclude subtrees of the class-tree, starting
+        with a given subclass, described by the corresponding Identifier. To minimize the size
+        of the mask, the mask saves only relevant rules. But you are allowed to manually add
+        rules that don't change the information of the mask. This way you can create the same
+        mask by adding the same rules in a different way without changing the information. If
+        you want to drop useless rules, call the clean() function.
+    */
     class ClassTreeMask
     {
@@ -126,5 +197,5 @@
             void clean(ClassTreeMaskNode* node);
 
-            ClassTreeMaskNode* root_;
+            ClassTreeMaskNode* root_;   //!< The root-node of the internal rule-tree, usually BaseObject
     };
 }
Index: code/branches/core/src/orxonox/core/Identifier.h
===================================================================
--- code/branches/core/src/orxonox/core/Identifier.h	(revision 808)
+++ code/branches/core/src/orxonox/core/Identifier.h	(revision 809)
@@ -180,4 +180,10 @@
         This makes it possible to store informations about a class, sharing them with all
         objects of that class without defining static variables in every class.
+
+        To be really sure that not more than exactly one object exists (even with libraries),
+        ClassIdentifiers are only created by IdentifierDistributor.
+
+        You can access the ClassIdentifiers created by IdentifierDistributor through the
+        ClassManager singletons.
     */
     template <class T>
Index: code/branches/core/src/orxonox/core/IdentifierDistributor.cc
===================================================================
--- code/branches/core/src/orxonox/core/IdentifierDistributor.cc	(revision 808)
+++ code/branches/core/src/orxonox/core/IdentifierDistributor.cc	(revision 809)
@@ -26,4 +26,9 @@
  */
 
+/*!
+    @file IdentifierDistributor.cc
+    @brief Implementation of the IdentifierDistributor class.
+*/
+
 #include "IdentifierDistributor.h"
 #include "Identifier.h"
@@ -31,15 +36,25 @@
 namespace orxonox
 {
+    /**
+        @brief Returns the only instance of a ClassIdentifier for a given class.
+        @param name The name of the class
+        @param proposal A proposal for the ClassIdentifier in case there is no entry yet.
+        @return The unique ClassIdentifier
+    */
     Identifier* IdentifierDistributor::getIdentifier(const std::string& name, Identifier* proposal)
     {
+        // Create the only instance of the IdentifierDistributor-singleton
         static IdentifierDistributor theOneAndOnlyInstance = IdentifierDistributor();
 
+        // Look for an entry in the map
         std::map<std::string, Identifier*>::const_iterator it = theOneAndOnlyInstance.identifiers_.find(name);
         if (it != theOneAndOnlyInstance.identifiers_.end())
         {
+            // There is already an entry: return it
             return (*it).second;
         }
         else
         {
+            // There is no entry: put the proposal into the map and return it
             theOneAndOnlyInstance.identifiers_[name] = proposal;
             return proposal;
Index: code/branches/core/src/orxonox/core/IdentifierDistributor.h
===================================================================
--- code/branches/core/src/orxonox/core/IdentifierDistributor.h	(revision 808)
+++ code/branches/core/src/orxonox/core/IdentifierDistributor.h	(revision 809)
@@ -26,4 +26,13 @@
  */
 
+/*!
+    @file IdentifierDistributor.h
+    @brief Definition of the IdentifierDistributor class
+
+    The IdentifierDistributor makes sure that only one instance of ClassIdentifier for each
+    template parameter T exists. All Identifiers are stored in a map with their name.
+    IdentifierDistributor is a singleton class, it can't be created or deleted directly.
+*/
+
 #ifndef _IdentifierDistributor_H__
 #define _IdentifierDistributor_H__
@@ -35,4 +44,5 @@
 namespace orxonox
 {
+    //! The Identifier Distributor stores all Identifiers and makes sure there are no ambiguities.
     class IdentifierDistributor
     {
@@ -41,9 +51,9 @@
 
         private:
-            IdentifierDistributor() {};
-            IdentifierDistributor(const IdentifierDistributor& distributor) {}
-            ~IdentifierDistributor() {}
+            IdentifierDistributor() {};                                         // Don't create
+            IdentifierDistributor(const IdentifierDistributor& distributor) {}  // Don't copy
+            ~IdentifierDistributor() {}                                         // Don't delete
 
-            std::map<std::string, Identifier*> identifiers_;
+            std::map<std::string, Identifier*> identifiers_;    //!< The map to store all Identifiers.
     };
 }
