Index: code/branches/notifications/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/branches/notifications/src/modules/notifications/NotificationManager.cc	(revision 7398)
+++ code/branches/notifications/src/modules/notifications/NotificationManager.cc	(revision 7399)
@@ -39,5 +39,7 @@
 #include "core/LuaState.h"
 #include "util/ScopedSingletonManager.h"
+
 #include "interfaces/NotificationListener.h"
+
 #include "Notification.h"
 #include "NotificationQueue.h"
@@ -56,5 +58,4 @@
     ManageScopedSingleton(NotificationManager, ScopeID::Graphics, false);
 
-    //TODO: Make work.
     SetConsoleCommand("enterEditMode", &NotificationManager::enterEditMode);
 
@@ -70,5 +71,5 @@
 
         ModifyConsoleCommand("enterEditMode").setObject(this);
-        
+
         COUT(3) << "NotificatioManager created." << std::endl;
     }
@@ -82,12 +83,18 @@
         ModifyConsoleCommand("enterEditMode").setObject(NULL);
 
+        //  Destroys all Notifications that have been registered with the NotificationManager.
         for(std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)
             it->second->destroy();
-        
+
         COUT(3) << "NotificationManager destroyed." << std::endl;
     }
 
+    /**
+    @brief
+        Is called before the object is destroyed.
+    */
     void NotificationManager::preDestroy(void)
     {
+        // Destroys all NotificationQueues that have been registered with the NotificationManager.
         for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); )
         {
@@ -109,9 +116,9 @@
     bool NotificationManager::registerNotification(Notification* notification)
     {
-        if(notification == NULL) // A NULL-Notification cannot be registered.
-            return false;
+        assert(notification);
 
         std::time_t time = std::time(0); //TODO: Doesn't this expire? //!< Get current time.
 
+        // Add the Notification to the list that holds all Notifications.
         this->allNotificationsList_.insert(std::pair<std::time_t, Notification*>(time, notification));
 
@@ -123,21 +130,15 @@
             all = true;
 
-        // Insert the notification in all listeners that have its sender as target.
-        for(std::map<NotificationListener*,int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) // Iterate through all listeners.
+        // Insert the Notification in all NotificationListeners that have its sender as target.
+        for(std::map<NotificationListener*, unsigned int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) // Iterate through all NotificationListeners.
         {
             std::set<std::string, NotificationListenerStringCompare> set = it->first->getTargetsSet();
             bool bAll = set.find(NotificationManager::ALL) != set.end();
-            if(all || bAll || set.find(notification->getSender()) != set.end()) //TODO: Make sure this works.
+            // If either the Notification has as sender 'all', the NotificationListener displays all Notifications or the NotificationListener has the sender of the Notification as target.
+            if(all || bAll || set.find(notification->getSender()) != set.end())
             {
                 if(!bAll)
-                {
-                    this->notificationLists_[it->second]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the Notifications list of the current NotificationListener.
-                }
-                it->first->update(notification, time); // Update the listener.
-                std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(notification);
-                if(counterIt == this->listenerCounter_.end())
-                    this->listenerCounter_[notification] = 1;
-                else
-                    this->listenerCounter_[notification] = counterIt->second + 1;
+                    this->notificationLists_[it->second]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationListener.
+                it->first->update(notification, time); // Update the NotificationListener.
             }
         }
@@ -150,5 +151,5 @@
     /**
     @brief
-        Unregisters a Notification within the NotificationManager.
+        Unregisters a Notification within the NotificationManager for a given NotificationListener.
     @param notification
         A pointer to the Notification to be unregistered.
@@ -161,7 +162,6 @@
         assert(listener);
 
-        // If the Notification was removed from the list of Notifications of the input NotificationListener, the counter for the Notification of the number of NotificationListeners it is present in is decremented.
-        if(this->removeNotification(notification, *(this->notificationLists_.find(this->listenerList_.find(listener)->second)->second)))
-            this->listenerCounter_[notification] = this->listenerCounter_[notification] - 1;
+        // Remove the Notification from the list of Notifications of the input NotificationListener.
+        this->removeNotification(notification, *(this->notificationLists_.find(this->listenerList_.find(listener)->second)->second));
 
         COUT(4) << "Notification (&" << notification << ") unregistered with the NotificationManager from listener (&" << listener << ")" << std::endl;
@@ -170,9 +170,9 @@
     /**
     @brief
-        Helper method that removes an input notification form an input map.
+        Helper method that removes an input Notification form an input map.
     @param notification
-        A pointer to the notification to be removed.
+        A pointer to the Notification to be removed.
     @param map
-        The map the notification should be removed from.
+        The map the Notification should be removed from.
     @return
         Returns true if successful.
@@ -199,20 +199,27 @@
         The NotificationListener to be registered.
     @return
-        Returns true if successful.
+        Returns true if successful.  Fales if the NotificationListener is already registered.
     */
     bool NotificationManager::registerListener(NotificationListener* listener)
     {
+        assert(listener);
+
+        // If the NotificationListener is already registered.
+        if(this->listenerList_.find(listener) != this->listenerList_.end())
+            return false;
+
         this->highestIndex_ += 1;
-        int index = this->highestIndex_;
-
-        this->listenerList_[listener] = index; // Add the NotificationListener to the list of listeners.
+        unsigned int index = this->highestIndex_; // An identifier that identifies each registered NotificationListener uniquely.
+
+        this->listenerList_[listener] = index; // Add the NotificationListener to the list of NotificationListeners.
 
         std::set<std::string, NotificationListenerStringCompare> set = listener->getTargetsSet();
 
-        // If all senders are the target of the listener, then the list of notification for that specific listener is te same as the list of all Notifications.
+        // If all senders are the target of the NotificationListener, then the list of Notifications for that specific NotificationListener is the same as the list of all Notifications.
         bool bAll = set.find(NotificationManager::ALL) != set.end();
         std::multimap<std::time_t, Notification*>* map;
         if(bAll)
             this->notificationLists_[index] = &this->allNotificationsList_;
+        // Else a new list (resp. multimap) is created and added to the list of Notification lists for NotificationListeners.
         else
         {
@@ -224,14 +231,6 @@
         for(std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)
         {
-            if(bAll || set.find(it->second->getSender()) != set.end()) // Checks whether the listener has the sender of the current notification as target.
-            {
-                if(!bAll)
-                    map->insert(std::pair<std::time_t, Notification*>(it->first, it->second));
-                std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(it->second);
-                if(counterIt == this->listenerCounter_.end())
-                    this->listenerCounter_[it->second] = 1;
-                else
-                    this->listenerCounter_[it->second] = counterIt->second + 1;
-            }
+            if(!bAll && set.find(it->second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.
+                map->insert(std::pair<std::time_t, Notification*>(it->first, it->second));
         }
 
@@ -245,5 +244,7 @@
     /**
     @brief
-        Unregisters a NotificationListener withing the NotificationManager.
+        Unregisters a NotificationListener within the NotificationManager.
+    @param listener
+        The NotificationListener to be unregistered.
     */
     void NotificationManager::unregisterListener(NotificationListener* listener)
@@ -251,8 +252,9 @@
         assert(listener);
 
-        int identifier = this->listenerList_.find(listener)->second;
+        //TODO: Make unsigned int.
+        unsigned int identifier = this->listenerList_.find(listener)->second;
         std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second;
 
-        // If the map is not the map of all notifications, make sure all Notifications are removed and delete it.
+        // If the map is not the map of all Notifications, make sure all Notifications are unregistered.
         std::multimap<std::time_t, Notification*>::iterator it = map->begin();
         if(map != &this->allNotificationsList_)
@@ -266,5 +268,7 @@
         }
 
+        // Remove the NotificationListener from the list of NotificationListeners.
         this->listenerList_.erase(listener);
+        // Remove the Notifications list that was associated with the input NotificationListener.
         this->notificationLists_.erase(identifier);
 
@@ -274,9 +278,9 @@
     /**
     @brief
-        Fetches the Notifications for a specific NotificationListener in a specified timeframe.
+        Fetches the Notifications for a specific NotificationListener in a specified timeframe and stores them in the input map.
     @param listener
         The NotificationListener the Notifications are fetched for.
     @param map
-        A multimap, in which the notifications are stored.
+        A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
     @param timeFrameStart
         The start time of the timeframe.
@@ -286,53 +290,24 @@
         Returns true if successful.
     */
-    bool NotificationManager::getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd)
-    {
-        if(listener == NULL || map == NULL)
-            return false;
-
-        std::multimap<std::time_t, Notification*>* notifications = this->notificationLists_[this->listenerList_[listener]]; // The Notifications for the input NotificationListener.
-
-        if(notifications == NULL) // Returns false, if there are no Notifications.
-            return false;
+    void NotificationManager::getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd)
+    {
+        assert(listener);
+        assert(map);
+
+        std::multimap<std::time_t, Notification*>* notifications = this->notificationLists_[this->listenerList_[listener]]; // All the Notifications for the input NotificationListener.
 
         std::multimap<std::time_t,Notification*>::iterator it, itLowest, itHighest;
+        // Iterators pointing to the bounds specified by the specified start and end times of the time frame.
         itLowest = notifications->lower_bound(timeFrameStart);
         itHighest = notifications->upper_bound(timeFrameEnd);
 
-        for(it = itLowest; it != itHighest; it++) // Iterate through the Notifications from the start of the time Frame to the end of it.
-            map->insert(std::pair<std::time_t, Notification*>(it->first,it->second)); // Add the found Notifications to the map.
-
-        return true;
-    }
-
-    void NotificationManager::loadQueues(void)
-    {
-        new NotificationQueue("all");
-    }
-
-    void NotificationManager::createQueue(const std::string& name)
-    {
-        new NotificationQueue(name);
-    }
-
-    NotificationQueue* NotificationManager::getQueue(const std::string & name)
-    {
-        std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.find(name);
-        if(it == this->queues_.end())
-            return NULL;
-
-        return (*it).second;
-    }
-
-    bool NotificationManager::registerQueue(NotificationQueue* queue)
-    {
-        return this->queues_.insert(std::pair<const std::string, NotificationQueue*>(queue->getName(), queue)).second;
-    }
-    
-    void NotificationManager::unregisterQueue(NotificationQueue* queue)
-    {
-        this->queues_.erase(queue->getName());
-    }
-
+        for(it = itLowest; it != itHighest; it++) // Iterate through the Notifications from the start of the time frame to the end of it.
+            map->insert(std::pair<std::time_t, Notification*>(it->first, it->second)); // Add the found Notifications to the map.
+    }
+
+    /**
+    @brief
+        Enters the edit mode of the NotificationLayer.
+    */
     void NotificationManager::enterEditMode(void)
     {
@@ -342,3 +317,67 @@
     }
 
+    /**
+    @brief
+        Registers a NotificationQueue.
+        This makes sure that the NotificationQueue can be attained through lua by name. It also makes sure that the NotificationQueue is destroyed upon destruction of the NotificationManager.
+    @param queue
+        A pointer to the NotificationQueue to be registered.
+    @return
+        Returns true if successful. If e.g. the a NotificationQueue with that name already exists this returns false.
+    */
+    bool NotificationManager::registerQueue(NotificationQueue* queue)
+    {
+        return this->queues_.insert(std::pair<const std::string, NotificationQueue*>(queue->getName(), queue)).second;
+    }
+
+    /**
+    @brief
+        Unregisters a NotificationQueue.
+    @param queue
+        A pointer to the NotificationQueue to be unregistered.
+    */
+    void NotificationManager::unregisterQueue(NotificationQueue* queue)
+    {
+        this->queues_.erase(queue->getName());
+    }
+
+    /**
+    @brief
+        Loads all the NotificationQueues that should exist.
+    */
+    void NotificationManager::loadQueues(void)
+    {
+        new NotificationQueue("all");
+    }
+
+    /**
+    @brief
+        Creates a new NotificationQueue.
+        This is used in lua.
+    @param name
+        The name of the new NotificationQueue.
+    */
+    void NotificationManager::createQueue(const std::string& name)
+    {
+        new NotificationQueue(name);
+    }
+
+    /**
+    @brief
+        Get the NotificationQueue with the input name.
+    @param name
+        The name of the NotificationQueue.
+    @return
+        Returns a pointer to the NotificationQueue with the input name. Returns NULL if no NotificationQueue with such a name exists.
+    */
+    NotificationQueue* NotificationManager::getQueue(const std::string & name)
+    {
+        std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.find(name);
+        // Returns NULL if no such NotificationQueue exists.
+        if(it == this->queues_.end())
+            return NULL;
+
+        return (*it).second;
+    }
+
 }
Index: code/branches/notifications/src/modules/notifications/NotificationManager.h
===================================================================
--- code/branches/notifications/src/modules/notifications/NotificationManager.h	(revision 7398)
+++ code/branches/notifications/src/modules/notifications/NotificationManager.h	(revision 7399)
@@ -62,5 +62,5 @@
             virtual ~NotificationManager();
 
-            virtual void preDestroy(void);
+            virtual void preDestroy(void); //!< Is called before the object is destroyed.
 
             static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export
@@ -70,45 +70,43 @@
 
             bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
-            void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager.
+            void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager for a given NotificationListener.
             bool registerListener(NotificationListener* listener); //!< Registers a NotificationListener within the NotificationManager.
             void unregisterListener(NotificationListener* listener); //!< Unregisters a NotificationListener withing the NotificationManager.
 
-            bool getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationListener in a specified timeframe.
+            void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Fetches the Notifications for a specific NotificationListener in a specified timeframe and stores them in the input map.
 
             /**
-            @brief Fetches the Notifications for a specific NotificationListener starting at a specified timespan before now.
+            @brief Fetches the Notifications for a specific NotificationListener in a timeframe from now-timeDelay to now and stores them in the input map.
             @param listener The NotificationListener the Notifications are fetched for.
-            @param map A multimap, in which the notifications are stored.
+            @param map A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
             @param timeDelay The timespan.
             @return Returns true if successful.
             */
-            bool getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int timeDelay)
-                { return this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); }
+            void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int timeDelay)
+                { this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); }
 
-            void enterEditMode(void);
+            void enterEditMode(void); //!< Enters the edit mode of the NotificationLayer.
+
+            bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue.
+            void unregisterQueue(NotificationQueue* queue); //!< Unregisters a NotificationQueue.
 
             // tolua_begin
-            void loadQueues(void);
-            
-            void createQueue(const std::string& name);
-            orxonox::NotificationQueue* getQueue(const std::string & name);
+            void loadQueues(void); //!< Loads all the NotificationQueues that should exist.
+            void createQueue(const std::string& name); //!< Creates a new NotificationQueue.
+            orxonox::NotificationQueue* getQueue(const std::string & name); //!< Get the NotificationQueue with the input name.
             // tolua_end
-
-            bool registerQueue(NotificationQueue* queue);
-            void unregisterQueue(NotificationQueue* queue);
 
         private:
             static NotificationManager* singletonPtr_s;
 
+            unsigned int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
+
+            std::multimap<std::time_t, Notification*> allNotificationsList_; //!< Container where all Notifications are stored.
+            std::map<NotificationListener*, unsigned int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier.
+            std::map<int,std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored.
+
             std::map<const std::string, NotificationQueue*> queues_; //!< The list of NotificationQueues created by the NotificationManager.
 
-            int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
-
-            std::multimap<std::time_t, Notification*> allNotificationsList_; //!< Container where all notifications are stored.
-            std::map<NotificationListener*, int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier.
-            std::map<int,std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored.
-            std::map<Notification*, unsigned int> listenerCounter_; //!< A container to store the number of NotificationListeners a Notification is registered with.
-
-            bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input notification form an input map.
+            bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input Notification form an input map.
 
     }; // tolua_export
Index: code/branches/notifications/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/branches/notifications/src/modules/notifications/NotificationQueue.cc	(revision 7398)
+++ code/branches/notifications/src/modules/notifications/NotificationQueue.cc	(revision 7399)
@@ -41,4 +41,6 @@
 #include "core/LuaState.h"
 #include "util/Convert.h"
+#include "util/SubString.h"
+
 #include "Notification.h"
 
@@ -49,4 +51,13 @@
     @brief
         Constructor. Creates and initializes the object.
+    @param name
+        The name of the new NotificationQueue.
+    @param senders
+        The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays.
+        The senders need to be seperated by commas.
+    @param size
+        The size (the maximum number of displayed Notifications) of this NotificationQueue.
+    @param displayTime
+        The time during which a Notification is (at most) displayed.
     */
     NotificationQueue::NotificationQueue(const std::string& name, const std::string& senders, unsigned int size, unsigned int displayTime)
@@ -56,6 +67,9 @@
         RegisterRootObject(NotificationQueue);
 
-        this->initialize();
-
+        // Initialize.
+        this->size_ = 0;
+        this->tickTime_ = 0.0;
+
+        // Sets the input values.
         this->setTargets(senders);
         this->name_ = name;
@@ -63,7 +77,10 @@
         this->setDisplayTime(displayTime);
 
+        //TODO: Destroy if registration fails?
+
+        // Register the NotificationQueue with the NotificationManager.
         bool queueRegistered = NotificationManager::getInstance().registerQueue(this);
         this->registered_ = true;
-        if(!queueRegistered)
+        if(!queueRegistered) // If the registration has failed.
         {
             this->registered_ = false;
@@ -72,10 +89,13 @@
         }
 
-        this->create();
-        
+        this->create(); // Creates the NotificationQueue in lua.
+
+        // register the NotificationQueue as NotificationListener with the NotificationManager.
         bool listenerRegistered = NotificationManager::getInstance().registerListener(this);
-        if(!listenerRegistered)
+        if(!listenerRegistered) // If the registration has failed.
         {
             this->registered_ = false;
+            // Remove the NotificationQueue in lua.
+            GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
             NotificationManager::getInstance().unregisterQueue(this);
             COUT(1) << "Error: Notification Queue '" << this->getName() << "' could not be registered." << std::endl;
@@ -94,24 +114,15 @@
         this->targets_.clear();
 
-        if(this->registered_)
+        if(this->registered_) // If the 
         {
             this->clear();
-            
+
+            // Unregister with the NotificationManager.
             NotificationManager::getInstance().unregisterListener(this);
             NotificationManager::getInstance().unregisterQueue(this);
 
+            // Remove the NotificationQueue in lua.
             GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
         }
-    }
-
-    /**
-    @brief
-        Initializes the object.
-        Registers the object, initializes variables, sets default values and registers the queue with the NotificationManager.
-    */
-    void NotificationQueue::initialize(void)
-    {
-        this->size_ = 0;
-        this->tickTime_ = 0.0;
     }
 
@@ -139,9 +150,10 @@
 
             std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator it = this->ordering_.begin();
-            while(it != this->ordering_.upper_bound(&this->timeLimit_)) // Iterate through all elements whose creation time is smaller than the current time minus the display time.
+            // Iterate through all elements whose creation time is smaller than the current time minus the display time.
+            while(it != this->ordering_.upper_bound(&this->timeLimit_))
             {
                 NotificationContainer* temp = *it;
                 it++;
-                this->remove(temp);
+                this->remove(temp); // Remove the Notifications that have expired.
             }
 
@@ -160,21 +172,17 @@
 
         std::multimap<std::time_t, Notification*>* notifications = new std::multimap<std::time_t, Notification*>;
-        if(!NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_)) // Get the Notifications sent in the interval form now to minus the display time.
-        {
-            COUT(1) << "NotificationQueue update failed due to undetermined cause." << std::endl;
-            return;
-        }
+        // Get the Notifications sent in the interval from now to now minus the display time.
+        NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_);
 
         if(!notifications->empty())
         {
-            for(std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++) // Add all Notifications.
-            {
+            // Add all Notifications.
+            for(std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)
                 this->push(it->second, it->first);
-            }
         }
 
         delete notifications;
 
-        COUT(3) << "NotificationQueue '" << this->getName() << "' updated." << std::endl; //TODO: Level 4.
+        COUT(4) << "NotificationQueue '" << this->getName() << "' updated." << std::endl;
     }
 
@@ -191,15 +199,15 @@
         this->push(notification, time);
 
-        COUT(3) << "NotificationQueue '" << this->getName() << "' updated. A new Notification has been added." << std::endl; //TODO: Level 4.
-    }
-
-    /**
-    @brief
-        Adds a Notification to the NotificationQueue.
+        COUT(4) << "NotificationQueue '" << this->getName() << "' updated. A new Notification has been added." << std::endl;
+    }
+
+    /**
+    @brief
+        Adds (pushes) a Notification to the NotificationQueue.
         It inserts it into the storage containers, creates a corresponding container and pushes the Notification message to the GUI.
     @param notification
-        The Notification.
+        The Notification to be pushed.
     @param time
-        The time.
+        The time when the Notification has been sent.
     */
     void NotificationQueue::push(Notification* notification, const std::time_t & time)
@@ -216,6 +224,8 @@
 
         this->ordering_.insert(container);
+        // Insert the Notification at the begin of the list (vector, actually).
         this->notifications_.insert(this->notifications_.begin(), container);
 
+        // Push the Notification to the GUI.
         GUIManager::getInstance().getLuaState()->doString("NotificationLayer.pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")");
     }
@@ -223,5 +233,5 @@
     /**
     @brief
-        Removes the least recently added Notification form the NotificationQueue.
+        Removes (pops) the least recently added Notification form the NotificationQueue.
     */
     void NotificationQueue::pop(void)
@@ -230,6 +240,10 @@
         this->ordering_.erase(container);
         this->notifications_.pop_back();
+
         this->size_--;
+
         delete container;
+
+        // Pops the Notification from the GUI.
         GUIManager::getInstance().getLuaState()->doString("NotificationLayer.popNotification(\"" + this->getName() + "\")");
     }
@@ -237,5 +251,5 @@
     /**
     @brief
-        Removes the Notification that is stored in the input container.
+        Removes the Notification that is stored in the input NotificationContainer.
     @param container
         The NotificationContainer with the Notification to be removed.
@@ -244,9 +258,14 @@
     {
         std::vector<NotificationContainer*>::iterator it = std::find(this->notifications_.begin(), this->notifications_.end(), container);
+        // Get the index at which the Notification is.
         std::vector<NotificationContainer*>::difference_type index = it - this->notifications_.begin ();
         this->ordering_.erase(container);
         this->notifications_.erase(it);
+
         this->size_--;
+
         delete container;
+
+        // Removes the Notification from the GUI.
         GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")");
     }
@@ -254,14 +273,18 @@
     /**
     @brief
-        Clears the queue by removing all Notifications.
+        Clears the NotificationQueue by removing all NotificationContainers.
     */
     void NotificationQueue::clear(void)
     {
         this->ordering_.clear();
+        // Delete all NotificationContainers in the list.
         for(std::vector<NotificationContainer*>::iterator it = this->notifications_.begin(); it != this->notifications_.end(); it++)
             delete *it;
 
         this->notifications_.clear();
+
         this->size_ = 0;
+
+        // Clear the NotificationQueue in the GUI.
         GUIManager::getInstance().getLuaState()->doString("NotificationLayer.clearQueue(\"" + this->getName() + "\")");
     }
@@ -272,11 +295,8 @@
     @param name
         The name to be set.
-    @return
-        returns true if successful.
-    */
-    bool NotificationQueue::setName(const std::string& name)
+    */
+    void NotificationQueue::setName(const std::string& name)
     {
         this->name_ = name;
-        return true;
     }
 
@@ -286,6 +306,4 @@
     @param size
         The size to be set.
-    @return
-        Returns true if successful.
     */
     void NotificationQueue::setMaxSize(unsigned int size)
@@ -293,17 +311,9 @@
         if(this->maxSize_ == size)
             return;
-        
+
         this->maxSize_ = size;
-        this->sizeChanged();
-    }
-
-    /**
-    @brief
-        Adjusts the NotificationQueue, when the maximum size has changed.
-    */
-    void NotificationQueue::sizeChanged(void)
-    {
-        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.changeSize(\"" + this->getName() + "\", " + multi_cast<std::string>(this->getSize()) + ")");
-        this->update();
+
+        if(this->registered_)
+            this->update();
     }
 
@@ -329,5 +339,5 @@
     /**
     @brief
-        Produces all targets concatinated as string, with kommas (',') as seperators.
+        Produces all targets of the NotificationQueue concatinated as string, with kommas (',') as seperators.
     @return
         Returns the targets as a string.
@@ -337,8 +347,9 @@
         std::stringstream stream;
         bool first = true;
-        for(std::set<std::string, NotificationListenerStringCompare>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++) // Iterate through the set of targets.
+        // Iterate through the set of targets.
+        for(std::set<std::string, NotificationListenerStringCompare>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
         {
             if(!first)
-                stream << ',';
+                stream << ", ";
             else
                 first = false;
@@ -351,29 +362,16 @@
     /**
     @brief
-        Sets the targets of the queue.
+        Sets the targets of the NotificationQueue.
         The targets are the senders whose Notifications are displayed in this queue.
     @param targets
         Accepts a string of targets, each seperated by commas (','), spaces are ignored.
-    @return
-        Returns true if successful.
-    */
-    bool NotificationQueue::setTargets(const std::string & targets)
+    */
+    void NotificationQueue::setTargets(const std::string & targets)
     {
         this->targets_.clear();
 
-        //TODO: Do with SubString.
-        std::string* pTemp;
-        unsigned int index = 0;
-        while(index < targets.size()) // Go through the string, character by character until the end is reached.
-        {
-            pTemp = new std::string();
-            while(index < targets.size() && targets[index] != ',' && targets[index] != ' ')
-            {
-                *pTemp += targets[index];
-                index++;
-            }
-            index++;
-            this->targets_.insert(*pTemp);
-        }
+        SubString string = SubString(targets, ",", " ", false);
+        for(unsigned int i = 0; i < string.size(); i++)
+            this->targets_.insert(string[i]);
 
         if(this->registered_)
@@ -382,6 +380,4 @@
             NotificationManager::getInstance().registerListener(this);
         }
-
-        return true;
     }
 
Index: code/branches/notifications/src/modules/notifications/NotificationQueue.h
===================================================================
--- code/branches/notifications/src/modules/notifications/NotificationQueue.h	(revision 7398)
+++ code/branches/notifications/src/modules/notifications/NotificationQueue.h	(revision 7399)
@@ -43,4 +43,5 @@
 
 #include "tools/interfaces/Tickable.h"
+
 #include "interfaces/NotificationListener.h"
 #include "NotificationManager.h"
@@ -76,10 +77,14 @@
             virtual ~NotificationQueue();
 
+            /**
+            @brief Destroys the NotificationQueue.
+                   Used in lua.
+            */
             void destroy(void) { this->OrxonoxClass::destroy(); } // tolua_export
 
             virtual void tick(float dt); //!< To update from time to time.
 
-            void update(void); //!< Updates the queue.
-            void update(Notification* notification, const std::time_t & time); //!< Adds a Notification to the queue.
+            void update(void); //!< Updates the NotificationQueue.
+            void update(Notification* notification, const std::time_t & time); //!< Updates the NotificationQueue by adding an new Notification.
 
             // tolua_begin
@@ -110,5 +115,5 @@
             /**
             @brief Returns the current number of Notifications displayed.
-            @return Returns the size of the queue.
+            @return Returns the size of the NotificationQueue.
             */
             inline unsigned int getSize() const
@@ -116,6 +121,6 @@
 
             /**
-            @brief Returns the targets of this queue, reps. the senders which Notifications are displayed in this queue.
-            @return Retuns a set of string holding the different targets.
+            @brief Returns the targets of this NotificationQueue, reps. the senders which Notifications are displayed in this NotificationQueue.
+            @return Returns a set of strings holding the different targets.
             */
             inline const std::set<std::string, NotificationListenerStringCompare> & getTargetsSet()
@@ -123,5 +128,5 @@
 
             // tolua_begin
-            bool setTargets(const std::string & targets); //!< Set the targets of this NotificationQueue.
+            void setTargets(const std::string & targets); //!< Set the targets of this NotificationQueue.
             const std::string& getTargets(void) const; //!< Returns a string consisting of the concatination of the targets.
             // tolua_end
@@ -137,7 +142,9 @@
             unsigned int displayTime_; //!< The time a Notification is displayed.
 
-            std::set<std::string, NotificationListenerStringCompare> targets_; //!< The targets the Queue displays Notifications of.
+            bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
 
-            std::multiset<NotificationContainer*, NotificationContainerCompare> ordering_; //!< The NotificationContainers ordered by the time they were registered. //TODO: Would set work as well?
+            std::set<std::string, NotificationListenerStringCompare> targets_; //!< The targets the NotificationQueue displays Notifications of.
+
+            std::multiset<NotificationContainer*, NotificationContainerCompare> ordering_; //!< The NotificationContainers ordered by the time they were registered.
             std::vector<NotificationContainer*> notifications_; //!< The NotificationContainers in the order they were added to the NotificationQueue.
 
@@ -145,18 +152,13 @@
             NotificationContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired.
 
-            bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
-
-            void initialize(void); //!< Initializes the object.
             void create(void); //!< Creates the NotificationQueue in lua.
 
-            bool setName(const std::string& name); //!< Sets the name of the NotificationQueue.
+            void setName(const std::string& name); //!< Sets the name of the NotificationQueue.
 
-            void sizeChanged(void); //!< Adjusts the NotificationQueue, when the maximum size has changed.
+            void push(Notification* notification, const std::time_t & time); //!< Adds (pushes) a Notification to the NotificationQueue.
+            void pop(void); //!< Removes (pops) the least recently added Notification form the NotificationQueue.
+            void remove(NotificationContainer* container); //!< Removes the Notification that is stored in the input NotificationContainer.
 
-            void push(Notification* notification, const std::time_t & time); //!< Add a Notification to the NotificationQueue.
-            void pop(void); //!< Removes the least recently added Notification form the NotificationQueue.
-            void remove(NotificationContainer* container); //!< Removes the Notification that is stored in the input container.
-
-            void clear(void); //!< Clears the queue by removing all Notifications.
+            void clear(void); //!< Clears the NotificationQueue by removing all NotificationContainers.
 
     }; // tolua_export
