Index: trunk/src/lib/event/event_handler.cc
===================================================================
--- trunk/src/lib/event/event_handler.cc	(revision 5284)
+++ trunk/src/lib/event/event_handler.cc	(revision 5285)
@@ -34,9 +34,11 @@
 EventHandler::EventHandler ()
 {
+  this->setClassID(CL_EVENT_HANDLER, "EventHandler");
+  this->setName("EventHandler");
+
   SDL_InitSubSystem(SDL_INIT_JOYSTICK);
   SDL_InitSubSystem(SDL_INIT_EVENTTHREAD);
 //  SDL_SetEventFilter(EventHandler::eventFilter);
 
-  this->setClassID(CL_EVENT_HANDLER, "EventHandler");
 
   /* now initialize them all to zero */
@@ -49,4 +51,5 @@
     }
   this->state = ES_GAME;
+  this->keyMapper = NULL;
 }
 
@@ -70,5 +73,5 @@
       if( this->listeners[i][j] != NULL)
       {
-        PRINTF(2)("forgot to unsubscribe an EventListener %s!\n");//, this->listeners[i][j]->getName());
+        PRINTF(2)("forgot to unsubscribe an EventListener!\n");// %s!\n", this->listeners[i][j]->getName());
       }
     }
@@ -84,6 +87,6 @@
 /**
  *  initializes the event handler
-
-   this has to be called before the use of the event handler
+ *
+ * this has to be called before the use of the event handler
 */
 void EventHandler::init(IniParser* iniParser)
@@ -142,5 +145,5 @@
 
 /**
- *  unsubscribe all events from a specific listener
+ * unsubscribe all events from a specific listener
  * @param el: the listener that wants to unsubscribe itself
  * @param state: the state in which the events shall be unsubscribed
@@ -174,5 +177,5 @@
 
 /**
- *  flush all registered events
+ * flush all registered events
  * @param state: a specific state
 */
Index: trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- trunk/src/lib/graphics/graphics_engine.cc	(revision 5284)
+++ trunk/src/lib/graphics/graphics_engine.cc	(revision 5285)
@@ -58,4 +58,7 @@
   this->hwVersion = NULL;
   this->hwExtensions = NULL;
+
+  // initialize the TextEngine
+  TextEngine::getInstance();
 }
 
@@ -81,4 +84,5 @@
 
   delete Render2D::getInstance();
+  delete TextEngine::getInstance();
 
   SDL_QuitSubSystem(SDL_INIT_VIDEO);
@@ -557,4 +561,5 @@
 {
   this->geTextCFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);
+  this->geTextCFPS->setName("curFPS");
   this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT);
   this->geTextCFPS->setAbsCoor2D(5, 15);
@@ -563,4 +568,5 @@
 {
       this->geTextMaxFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);
+      this->geTextMaxFPS->setName("MaxFPS");
       this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT);
       this->geTextMaxFPS->setAbsCoor2D(5, 40);
@@ -569,4 +575,5 @@
 {
       this->geTextMinFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);
+      this->geTextMinFPS->setName("MinFPS");
       this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
       this->geTextMinFPS->setAbsCoor2D(5, 65);
Index: trunk/src/lib/graphics/render2D/element_2d.cc
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.cc	(revision 5284)
+++ trunk/src/lib/graphics/render2D/element_2d.cc	(revision 5285)
@@ -25,17 +25,26 @@
 #include "class_list.h"
 #include "list.h"
+#include "color.h"
 
 using namespace std;
 
+/**
+ * standard constructor
+ */
 Element2D::Element2D()
 {
   this->init();
+
   this->setParent2D(NullElement2D::getInstance());
+  NullElement2D::getInstance()->debug(0);
 }
 
 /**
  * standard constructor
- * @todo this constructor is not jet implemented - do it
-*/
+ * @param parent the parent to set for this Element2D
+ *
+ * NullElement2D needs this constructor with parameter NULL to initialize
+ * itself. Otherwise it would result in an endless Loop.
+ */
 Element2D::Element2D (Element2D* parent)
 {
@@ -44,9 +53,22 @@
   if (this->parent != NULL)
     this->setParent2D(parent);
+  else if (NullElement2D::isInstanciated())
+    this->setParent2D(NullElement2D::getInstance());
 }
 
 /**
  * standard deconstructor
-*/
+ *
+ * There are two general ways to delete an Element2D
+ * 1. delete instance;
+ *   -> result
+ *    delete this Node and all its children and children's children...
+ *    (danger if you still want the instance!!)
+ *
+ * 2. instance->remove2D(); delete instance;
+ *   -> result:
+ *    moves its children to the NullParent
+ *    then deletes the Element.
+ */
 Element2D::~Element2D ()
 {
@@ -54,20 +76,23 @@
   Render2D::getInstance()->unregisterElement2D(this);
 
-  if (this->parent)
-    this->parent->removeChild2D(this);
-  else
-  {
-    tIterator<Element2D>* iterator = this->children->getIterator();
-    Element2D* pn = iterator->firstElement();
-    while( pn != NULL)
-    {
-      delete pn;
-      pn = iterator->nextElement();
-    }
-    delete iterator;
-    /* this deletes all children in the list */
+  // remove the Node, delete it's children.
+  tIterator<Element2D>* iterator = this->children->getIterator();
+  Element2D* child = iterator->firstElement();
+
+  while( child != NULL)
+  {
+    delete child;
+    child = iterator->nextElement();
+  }
+  delete iterator;
+
+  if (this->parent != NULL)
+  {
+    this->parent->children->remove(this);
+    this->parent = NULL;
   }
   delete this->children;
 
+  // remove all other allocated memory.
   if (this->toCoordinate != NULL)
     delete this->toCoordinate;
@@ -99,6 +124,4 @@
   this->toCoordinate = NULL;
   this->toDirection = NULL;
-//  else
-  //  this->setParent2D(parent);
 
   Render2D::getInstance()->registerElement2D(this);
@@ -480,7 +503,7 @@
 
 /**
- * remove this pnode from the tree and adds all following to NullParent
+ * remove this Element from the tree and adds all children to NullElement2D
  *
- * this can be the case, if an entity in the world is being destroyed.
+ * afterwards this Node is free, and can be reattached, or deleted freely.
  */
 void Element2D::remove2D()
@@ -495,6 +518,13 @@
   }
   delete iterator;
+
+  delete this->children;
+  this->children = new tList<Element2D>;
+
   if (this->parent != NULL)
+  {
     this->parent->children->remove(this);
+    this->parent = NULL;
+  }
 }
 
@@ -762,5 +792,12 @@
 }
 
-#include "color.h"
+/**
+ * ticks the 2d-Element
+ * @param dt the time elapsed since the last tick
+ */
+void Element2D::tick(float dt)
+{
+
+}
 
 /**
@@ -816,20 +853,7 @@
 
 
-
-/**
- * ticks the 2d-Element
- * @param dt the time elapsed since the last tick
- */
-void Element2D::tick(float dt)
-{
-
-}
-
-
-
-
-
-
-
+///////////////////
+// NullElement2D //
+///////////////////
 NullElement2D* NullElement2D::singletonRef = 0;
 
Index: trunk/src/lib/graphics/render2D/element_2d.h
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.h	(revision 5284)
+++ trunk/src/lib/graphics/render2D/element_2d.h	(revision 5285)
@@ -218,5 +218,6 @@
   public:
     /** @returns a Pointer to the only object of this Class */
-    inline static NullElement2D* getInstance() { if (!singletonRef) singletonRef = new NullElement2D();  return singletonRef; };
+    inline static NullElement2D* getInstance() { if (!NullElement2D::singletonRef) NullElement2D::singletonRef = new NullElement2D();  return NullElement2D::singletonRef; };
+    inline static bool isInstanciated() { return (NullElement2D::singletonRef != NULL)?true:false; };
     virtual ~NullElement2D ();
 
Index: trunk/src/lib/graphics/shader.cc
===================================================================
--- trunk/src/lib/graphics/shader.cc	(revision 5284)
+++ trunk/src/lib/graphics/shader.cc	(revision 5285)
@@ -49,11 +49,11 @@
 
        if (vertexShaderFile != NULL)
-	 this->loadShaderProgramm(SHADER_VERTEX, vertexShaderFile);
+         this->loadShaderProgramm(SHADER_VERTEX, vertexShaderFile);
        if (fragmentShaderFile != NULL)
-	 this->loadShaderProgramm(SHADER_FRAGMENT, fragmentShaderFile);
+         this->loadShaderProgramm(SHADER_FRAGMENT, fragmentShaderFile);
        try  {
-	 glLinkProgramARB(this->shaderProgram); }
+         glLinkProgramARB(this->shaderProgram); }
        catch(GLenum errorCode)  {
-	 this->printError(this->shaderProgram); }
+         this->printError(this->shaderProgram); }
      }
    else
@@ -84,4 +84,6 @@
 bool Shader::loadShaderProgramm(SHADER_TYPE type, const char* fileName)
 {
+  GLenum shader = 0;
+
   if (type != SHADER_VERTEX && type != SHADER_FRAGMENT)
     return false;
@@ -92,5 +94,4 @@
   if (program == NULL)
     return false;
-  GLenum shader = 0;
   if (type == SHADER_VERTEX && GLEW_ARB_vertex_shader)
   {
@@ -113,10 +114,10 @@
       glShaderSourceARB(shader, 1, (const GLcharARB**)&program, NULL);
       try {
-	glCompileShaderARB(shader);
+        glCompileShaderARB(shader);
       }
       catch (...)
-	{
-	  this->printError(shader);
-	}
+        {
+          this->printError(shader);
+        }
       glAttachObjectARB(this->shaderProgram, shader);
       delete[] program;
Index: trunk/src/lib/graphics/text_engine.cc
===================================================================
--- trunk/src/lib/graphics/text_engine.cc	(revision 5284)
+++ trunk/src/lib/graphics/text_engine.cc	(revision 5285)
@@ -848,6 +848,6 @@
 /**
  *  creates a new Text with a certain font.
-   @see Font::Font
-   @see Text::Text
+ * @see Font::Font
+ * @see Text::Text
 */
 Text* TextEngine::createText(const char* fontFile, unsigned int fontSize, int textType)
Index: trunk/src/lib/util/list.h
===================================================================
--- trunk/src/lib/util/list.h	(revision 5284)
+++ trunk/src/lib/util/list.h	(revision 5285)
@@ -135,5 +135,5 @@
 
 /**
- *  remove an entity from the list
+ * remove an entity from the list
  * @param entity: the entity to be removed
  */
