Index: orxonox/trunk/src/garbage_collector.cc
===================================================================
--- orxonox/trunk/src/garbage_collector.cc	(revision 3660)
+++ orxonox/trunk/src/garbage_collector.cc	(revision 3661)
@@ -88,19 +88,21 @@
   WorldInterface* wi = WorldInterface::getInstance();
   tList<WorldEntity>* list = wi->getEntityList();
-  //WorldEntity* entity = list->enumerate(); 
- // while( entity != NULL) 
-  //  { 
-  //  if( entity->isFinalized())
-  //{
-  //  PRINTF(3)("Finalizing object in list - not yet done realy\n");
+
+  tIterator<WorldEntity>* iterator = list->getIterator();
+  WorldEntity* entity = iterator->nextElement();
+  while( entity != NULL) 
+    { 
+      if( entity->isFinalized())
+	{
+	  PRINTF(3)("Finalizing object in list - not yet done realy\n");
 	  /* first remove out of entity list */
 	  //list->remove(entity);
 	  /* second remove out of pnode tree */
-	  //NullParent* np = NullParent::getInstance();
+	  //llParent* np = NullParent::getInstance();
 	  //np->removeChild(np);
 	  
-  //}
-  //   entity = list->nextElement();
-  //}
+	}
+      entity = iterator->nextElement();
+    }
   
   /* reset time to count again up to this->delay */
Index: orxonox/trunk/src/lib/util/list.h
===================================================================
--- orxonox/trunk/src/lib/util/list.h	(revision 3660)
+++ orxonox/trunk/src/lib/util/list.h	(revision 3661)
@@ -66,4 +66,5 @@
   listElement<T>* currentEl;
   listElement<T>* firstEl;
+  int counter;
 };
 
@@ -74,4 +75,5 @@
   this->currentEl = startElement;
   this->firstEl = startElement;
+  this->counter = -1;
 }
 
@@ -87,11 +89,11 @@
 inline T* tIterator<T>::nextElement ()
 {
-  if( this->currentEl == NULL || this->currentEl->next == NULL) /* don't turn it the other way or it will give segfaults! */
-      return NULL;
-  if( this->currentEl == this->firstEl)
-    {
-      this->currentEl = this->currentEl->next;
-      return this->firstEl->curr; /* if its the first element, don't return second element*/
-    }
+  this->counter++;
+  if( this->counter == 0)
+    return this->firstEl->curr;
+  
+  if( this->currentEl->next == NULL || this->currentEl == NULL)
+    return NULL;
+
   this->currentEl = this->currentEl->next;
   return this->currentEl->curr;
@@ -154,5 +156,5 @@
 
 template<class T>
-void tList<T>::add(T* entity)
+inline void tList<T>::add(T* entity)
 {
   if( entity == NULL) return;
@@ -171,5 +173,5 @@
 
 template<class T>
-void tList<T>::remove(T* entity)
+inline void tList<T>::remove(T* entity)
 {
   if( entity == NULL) return;
Index: orxonox/trunk/src/orxonox.cc
===================================================================
--- orxonox/trunk/src/orxonox.cc	(revision 3660)
+++ orxonox/trunk/src/orxonox.cc	(revision 3661)
@@ -346,5 +346,5 @@
 
 
-#define LIST_MAX 10000
+#define LIST_MAX 1000
 #define VECTOR_MAX 1000000
 #define ITERATIONS 10000
@@ -635,4 +635,92 @@
 	  printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi);
 	}
+      if( type == 3 || type == -1)
+	{
+	  /* list tests*/
+	  printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX);
+	  tList<char>* list = new tList<char>();
+	  char* name;
+
+	  printf(" Adding[1..10] elements to list, found:\n");
+	  list->add("1");
+	  list->add("2");
+	  list->add("3");
+	  list->add("4");
+	  list->add("5");
+	  list->add("6");
+	  list->add("7");
+	  list->add("8");
+	  list->add("9");
+	  list->add("10");
+
+	  /*give list out */
+	  tIterator<char>* iterator = list->getIterator();
+	  name = iterator->nextElement();
+	  printf("  List Elements: \t\t");
+	  while( name != NULL)
+	    {
+	      printf("%s,", name);
+	      name = iterator->nextElement();
+	    }
+	  delete iterator;
+	  printf("\n");
+
+
+	  /*removing some elements from the list*/
+	  printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n");
+	  list->remove("2");
+	  list->remove("3");
+	  list->remove("6");
+	  list->remove("8");
+	  list->remove("10");
+	  list->add("11");
+	  /*give list out */
+	  iterator = list->getIterator();
+	  name = iterator->nextElement();
+	  printf("  List Elements: \t\t");
+	  while( name != NULL)
+	    {
+	      printf("%s,", name);
+	      name = iterator->nextElement();
+	    }
+	  delete iterator;
+	  printf("\n");
+	  
+	  delete list;
+	  printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX);
+
+	  tList<int>* plist = new tList<int>();
+	  unsigned long mittel, ini, end;
+	  float mi;
+	  int i = 0;
+	  mittel = 0;
+	  for(i = 0; i < LIST_MAX; ++i)
+	    {
+	      rdtscl(ini);
+	      
+	      plist->add(&i);
+	      
+	      rdtscl(end);
+	      mittel += (end - ini - dt);
+	    }
+	  mi = mittel / (float)LIST_MAX;
+	  printf(" Adding reference to list:\t\t%11.2f\n", mi);
+
+	  mittel = 0;
+	  for(i = 0; i < LIST_MAX; ++i)
+	    {
+	      rdtscl(ini);
+	      
+	      plist->remove(&i);
+	      
+	      rdtscl(end);
+	      mittel += (end - ini - dt);
+	    }
+	  mi = mittel / (float)LIST_MAX;
+	  printf(" Removing 1st reference from list:\t%11.2f\n", mi);
+	  
+	  
+
+	}
     }
 }
Index: orxonox/trunk/src/simple_animation.cc
===================================================================
--- orxonox/trunk/src/simple_animation.cc	(revision 3660)
+++ orxonox/trunk/src/simple_animation.cc	(revision 3661)
@@ -111,10 +111,12 @@
 SimpleAnimation::~SimpleAnimation () 
 {
-  KeyFrame* frame = this->frames->enumerate(); 
+  tIterator<KeyFrame>* iterator = this->frames->getIterator();
+  KeyFrame* frame = iterator->nextElement(); 
   while( frame != NULL) 
     { 
       delete frame;
-      frame = frames->nextElement();
+      frame = iterator->nextElement();
     }
+  delete iterator;
   delete this->frames;
 }
@@ -163,10 +165,12 @@
 void SimpleAnimation::reset()
 {
-  KeyFrame* frame = this->frames->enumerate(); 
+  tIterator<KeyFrame>* iterator = this->frames->getIterator();
+  KeyFrame* frame = iterator->nextElement(); 
   while( frame != NULL) 
     { 
       delete frame;
-      frame = frames->nextElement();
+      frame = iterator->nextElement();
     }
+  delete iterator;
   delete this->frames;
 
Index: orxonox/trunk/src/track_manager.cc
===================================================================
--- orxonox/trunk/src/track_manager.cc	(revision 3660)
+++ orxonox/trunk/src/track_manager.cc	(revision 3661)
@@ -70,10 +70,12 @@
   if ((!this->isJoined &&this->childCount > 0) || (this->isJoined && this->mainJoin))
     {
-      TrackElement* enumElem = children->enumerate();
+      tIterator<TrackElement>* iterator = this->children->getIterator();
+      TrackElement* enumElem = iterator->nextElement();
       while (enumElem)
 	{
 	  delete enumElem;
-	  enumElem = children->nextElement();
+	  enumElem = iterator->nextElement();
 	}
+      delete iterator;
       delete this->children;
     }
@@ -95,5 +97,6 @@
   if (this->childCount > 0)
     {
-      TrackElement* enumElem = this->children->enumerate();
+      tIterator<TrackElement>* iterator = this->children->getIterator();
+      TrackElement* enumElem = iterator->nextElement();
       TrackElement* tmpElem;
       while (enumElem)
@@ -101,6 +104,7 @@
 	  if ((tmpElem = enumElem->findByID(trackID)))
 	    return tmpElem;
-	  enumElem = this->children->nextElement();
+	  enumElem = iterator->nextElement();
 	}
+      delete iterator;
     }
   else 
@@ -120,11 +124,13 @@
   else
     {
-      TrackElement* enumElem = this->children->enumerate();
+      tIterator<TrackElement>* iterator = this->children->getIterator();
+      TrackElement* enumElem = iterator->nextElement();
       while (enumElem)
 	{
 	  if(!enumElem->backLoopCheck(trackElem))
 	    return false;
-	  enumElem = this->children->nextElement();
+	  enumElem = iterator->nextElement();
 	}
+      delete iterator;
       
       return true;
