Index: code/branches/objecthierarchy/src/core/BaseObject.cc
===================================================================
--- code/branches/objecthierarchy/src/core/BaseObject.cc	(revision 2063)
+++ code/branches/objecthierarchy/src/core/BaseObject.cc	(revision 2065)
@@ -35,4 +35,5 @@
 #include "tinyxml/tinyxml.h"
 #include "CoreIncludes.h"
+#include "EventIncludes.h"
 #include "XMLPort.h"
 #include "XMLFile.h"
@@ -79,4 +80,6 @@
     BaseObject::~BaseObject()
     {
+        for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it)
+            (*it)->eventListeners_.erase(this);
     }
 
@@ -184,5 +187,6 @@
     void BaseObject::addEvent(BaseObject* event, const std::string& sectionname)
     {
-        this->eventListeners_.insert(std::pair<std::string, BaseObject*>(sectionname, event));
+        event->eventListeners_[this] = sectionname;
+        this->events_.push_back(event);
     }
 
@@ -190,8 +194,8 @@
     {
         unsigned int i = 0;
-        for (std::set<std::pair<std::string, BaseObject*> >::const_iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
+        for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it)
         {
             if (i == index)
-                return (*it).second;
+                return (*it);
             ++i;
         }
@@ -230,8 +234,8 @@
         Event event(activate, this);
 
-        for (std::set<std::pair<std::string, BaseObject*> >::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
-        {
-            event.sectionname_ = (*it).first;
-            (*it).second->processEvent(event);
+        for (std::map<BaseObject*, std::string>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
+        {
+            event.sectionname_ = it->second;
+            it->first->processEvent(event);
         }
     }
Index: code/branches/objecthierarchy/src/core/BaseObject.h
===================================================================
--- code/branches/objecthierarchy/src/core/BaseObject.h	(revision 2063)
+++ code/branches/objecthierarchy/src/core/BaseObject.h	(revision 2065)
@@ -36,4 +36,6 @@
 #ifndef _BaseObject_H__
 #define _BaseObject_H__
+
+#include <map>
 
 #include "CorePrereqs.h"
@@ -145,5 +147,6 @@
             Gametype*             oldGametype_;
             std::set<Template*>   templates_;
-            std::set<std::pair<std::string, BaseObject*> > eventListeners_;
+            std::map<BaseObject*, std::string> eventListeners_;
+            std::list<BaseObject*> events_;
             std::map<std::string, EventContainer*> eventContainers_;
     };
Index: code/branches/objecthierarchy/src/core/Event.cc
===================================================================
--- code/branches/objecthierarchy/src/core/Event.cc	(revision 2063)
+++ code/branches/objecthierarchy/src/core/Event.cc	(revision 2065)
@@ -29,7 +29,13 @@
 #include "Event.h"
 #include "BaseObject.h"
+#include "Executor.h"
 
 namespace orxonox
 {
+    EventContainer::~EventContainer()
+    {
+        delete this->eventfunction_;
+    }
+
     void EventContainer::process(BaseObject* object, const Event& event)
     {
Index: code/branches/objecthierarchy/src/core/Event.h
===================================================================
--- code/branches/objecthierarchy/src/core/Event.h	(revision 2063)
+++ code/branches/objecthierarchy/src/core/Event.h	(revision 2065)
@@ -31,28 +31,4 @@
 
 #include "CorePrereqs.h"
-#include "Executor.h"
-
-#define SetEvent(classname, eventname, functionname, event) \
-    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, orxonox::createExecutor(orxonox::createFunctor(&classname::functionname), std::string( #classname ) + "::" + #functionname), event, BaseObject)
-
-#define SetEventTemplate(classname, eventname, functionname, event, ...) \
-    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::functionname), std::string( #classname ) + "::" + #functionname), event, BaseObject)
-
-#define SetSubclassEvent(classname, eventname, functionname, event, subclassname) \
-    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, orxonox::createExecutor(orxonox::createFunctor(&classname::functionname), std::string( #classname ) + "::" + #functionname), event, subclassname)
-
-#define SetSubclassEventTemplate(classname, eventname, functionname, event, subclassname, ...) \
-    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::functionname), std::string( #classname ) + "::" + #functionname), event, subclassname)
-
-#define SetEventGeneric(containername, classname, eventname, executor, event, subclassname) \
-    orxonox::EventContainer* containername = this->getEventContainer(eventname); \
-    if (!containername) \
-    { \
-        containername = new orxonox::EventContainer(std::string(eventname), executor, orxonox::ClassIdentifier<subclassname>::getIdentifier()); \
-        this->addEventContainer(eventname, containername); \
-    } \
-    event.castedOriginator_ = dynamic_cast<subclassname*>(event.originator_); \
-    containername->process(this, event)
-
 
 namespace orxonox
@@ -72,6 +48,5 @@
         public:
             EventContainer(const std::string& eventname, Executor* eventfunction, Identifier* subclass) : eventname_(eventname), eventfunction_(eventfunction), subclass_(subclass), activeEvents_(0) {}
-            ~EventContainer()
-                { delete this->eventfunction_; }
+            ~EventContainer();
 
             void process(BaseObject* object, const Event& event);
Index: code/branches/objecthierarchy/src/core/XMLPort.h
===================================================================
--- code/branches/objecthierarchy/src/core/XMLPort.h	(revision 2063)
+++ code/branches/objecthierarchy/src/core/XMLPort.h	(revision 2065)
@@ -480,7 +480,9 @@
 
                                                 BaseObject* newObject = identifier->fabricate((BaseObject*)object);
+                                                assert(newObject);
                                                 newObject->setLoaderIndentation(((BaseObject*)object)->getLoaderIndentation() + "  ");
-//                                                newObject->setFile(((BaseObject*)object)->getFile());
-//                                                newObject->setNamespace(((BaseObject*)object)->getNamespace());
+
+                                                O* castedObject = dynamic_cast<O*>(newObject);
+                                                assert(castedObject);
 
                                                 if (this->bLoadBefore_)
@@ -495,5 +497,5 @@
 
                                                 COUT(5) << ((BaseObject*)object)->getLoaderIndentation();
-                                                (*this->loadexecutor_)(object, newObject);
+                                                (*this->loadexecutor_)(object, castedObject);
 
                                                 if (!this->bLoadBefore_)
