Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 0e2a479de952e453e6f956e78d72739043a4c7a5)
+++ src/Makefile.am	(revision d2dbac02371bc4bee8282cbe021c353e01009dd0)
@@ -32,5 +32,5 @@
 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp Descriptors/AtomIdDescriptor.hpp Descriptors/AtomTypeDescriptor.hpp
 
-SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} ${UISOURCE} ${DESCRIPTORSOURCE} ${LEGACYSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp lists.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp World.cpp 
+SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} ${UISOURCE} ${DESCRIPTORSOURCE} ${LEGACYSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp lists.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp World.cpp WorldIterators.cpp
 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${PATTERNHEADER} ${UIHEADER} ${DESCRIPTORHEADER} ${LEGACYHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp World.hpp 
 
Index: src/World.cpp
===================================================================
--- src/World.cpp	(revision 0e2a479de952e453e6f956e78d72739043a4c7a5)
+++ src/World.cpp	(revision d2dbac02371bc4bee8282cbe021c353e01009dd0)
@@ -49,5 +49,6 @@
   mol = new molecule(periode);
   molecules_deprecated->insert(mol);
-  molecules.insert(mol);
+  assert(!molecules.count(currMoleculeId));
+  molecules[currMoleculeId++] = mol;
   mol->signOn(this);
   return mol;
@@ -58,4 +59,5 @@
   OBSERVE;
   atom *res = NewAtom();
+  assert(!atoms.count(currAtomId));
   res->setId(currAtomId++);
   res->setWorld(this);
@@ -66,4 +68,5 @@
 int World::registerAtom(atom *atom){
   OBSERVE;
+  assert(!atoms.count(currAtomId));
   atom->setId(currAtomId++);
   atom->setWorld(this);
@@ -107,78 +110,7 @@
 /******************************* Iterators ********************************/
 
-World::AtomIterator::AtomIterator(){
-  state = World::get()->atomEnd();
-}
-
-World::AtomIterator::AtomIterator(AtomDescriptor _descr, World* _world) :
-    descr(_descr.get_impl()),
-    world(_world),
-    index(0)
-{
-  state = world->atoms.begin();
-  advanceState();
-}
-
-World::AtomIterator::AtomIterator(const AtomIterator& rhs) :
-    state(rhs.state),
-    descr(rhs.descr),
-    index(rhs.index),
-    world(rhs.world)
-  {}
-
-World::AtomIterator& World::AtomIterator::operator=(const AtomIterator& rhs)
-{
-  if(&rhs!=this){
-    state=rhs.state;
-    descr=rhs.descr;
-    index=rhs.index;
-    world=rhs.world;
-  }
-  return *this;
-}
-
-World::AtomIterator& World::AtomIterator::operator++(){
-  ++state;
-  ++index;
-  advanceState();
-  return *this;
-}
-
-World::AtomIterator World::AtomIterator::operator++(int){
-  AtomIterator res(*this);
-  ++(*this);
-  return res;
-}
-
-bool World::AtomIterator::operator==(const AtomIterator& rhs){
-  return state==rhs.state;
-}
-
-bool World::AtomIterator::operator==(const World::AtomList::iterator& rhs){
-  return state==rhs;
-}
-
-bool World::AtomIterator::operator!=(const AtomIterator& rhs){
-  return state!=rhs.state;
-}
-
-bool World::AtomIterator::operator!=(const World::AtomList::iterator& rhs){
-  return state!=rhs;
-}
-
-atom* World::AtomIterator::operator*(){
-  return (*state).second;
-}
-
-void World::AtomIterator::advanceState(){
-  while((state!=world->atoms.end()) && (!descr->predicate(*state))){
-    ++state;
-    ++index;
-  }
-}
-
-int World::AtomIterator::getCount(){
-  return index;
-}
+/*
+ * Actual Implementation of the iterators can be found in WorldIterators.cpp
+ */
 
 World::AtomIterator World::getAtomIter(AtomDescriptor descr){
@@ -186,5 +118,5 @@
 }
 
-World::AtomList::iterator World::atomEnd(){
+World::AtomSet::iterator World::atomEnd(){
   return atoms.end();
 }
@@ -200,7 +132,9 @@
 World::World() :
     currAtomId(0),
+    currMoleculeId(0),
     periode(new periodentafel),
     molecules_deprecated(new MoleculeListClass),
-    atoms()
+    atoms(),
+    molecules()
 {
   molecules_deprecated->signOn(this);
@@ -211,5 +145,5 @@
   delete molecules_deprecated;
   delete periode;
-  AtomList::iterator iter;
+  AtomSet::iterator iter;
   for(iter=atoms.begin();iter!=atoms.end();++iter){
     DeleteAtom((*iter).second);
Index: src/World.hpp
===================================================================
--- src/World.hpp	(revision 0e2a479de952e453e6f956e78d72739043a4c7a5)
+++ src/World.hpp	(revision d2dbac02371bc4bee8282cbe021c353e01009dd0)
@@ -41,5 +41,6 @@
 template<typename> friend class AtomsCalculation;
 
-typedef std::map<int,atom*> AtomList;
+typedef std::map<int,atom*> AtomSet;
+typedef std::map<int,molecule*> MoleculeSet;
 public:
 
@@ -131,7 +132,7 @@
     AtomIterator  operator++(int);  // postfix with dummy parameter
     bool operator==(const AtomIterator&);
-    bool operator==(const AtomList::iterator&);
+    bool operator==(const AtomSet::iterator&);
     bool operator!=(const AtomIterator&);
-    bool operator!=(const AtomList::iterator&);
+    bool operator!=(const AtomSet::iterator&);
     atom* operator*();
 
@@ -140,5 +141,5 @@
     void advanceState();
     World* world;
-    AtomList::iterator state;
+    AtomSet::iterator state;
     boost::shared_ptr<AtomDescriptor_impl>  descr;
     int index;
@@ -152,10 +153,10 @@
 
   /**
-   * returns an iterator to the end of the AtomList. Due to overloading this iterator
+   * returns an iterator to the end of the AtomSet. Due to overloading this iterator
    * can be compared to iterators produced by getAtomIter (see the mis-matching types).
    * Thus it can be used to detect when such an iterator is at the end of the list.
    * used for internal purposes, like AtomProcesses and AtomCalculations.
    */
-  AtomList::iterator atomEnd();
+  AtomSet::iterator atomEnd();
 
   /******* Internal manipulation routines for double callback and Observer mechanism ******/
@@ -164,7 +165,8 @@
 private:
   periodentafel *periode;
-  AtomList atoms;
+  AtomSet atoms;
   int currAtomId; //!< stores the next available Id for atoms
-  std::set<molecule*> molecules;
+  MoleculeSet molecules;
+  int currMoleculeId;
 
 
Index: src/WorldIterators.cpp
===================================================================
--- src/WorldIterators.cpp	(revision d2dbac02371bc4bee8282cbe021c353e01009dd0)
+++ src/WorldIterators.cpp	(revision d2dbac02371bc4bee8282cbe021c353e01009dd0)
@@ -0,0 +1,86 @@
+/*
+ * WorldIterators.cpp
+ *
+ *  Created on: Feb 25, 2010
+ *      Author: crueger
+ */
+
+#include "Descriptors/AtomDescriptor.hpp"
+#include "Descriptors/AtomDescriptor_impl.hpp"
+#include "atom.hpp"
+#include "World.hpp"
+
+World::AtomIterator::AtomIterator(){
+  state = World::get()->atomEnd();
+}
+
+World::AtomIterator::AtomIterator(AtomDescriptor _descr, World* _world) :
+    descr(_descr.get_impl()),
+    world(_world),
+    index(0)
+{
+  state = world->atoms.begin();
+  advanceState();
+}
+
+World::AtomIterator::AtomIterator(const AtomIterator& rhs) :
+    state(rhs.state),
+    descr(rhs.descr),
+    index(rhs.index),
+    world(rhs.world)
+  {}
+
+World::AtomIterator& World::AtomIterator::operator=(const AtomIterator& rhs)
+{
+  if(&rhs!=this){
+    state=rhs.state;
+    descr=rhs.descr;
+    index=rhs.index;
+    world=rhs.world;
+  }
+  return *this;
+}
+
+World::AtomIterator& World::AtomIterator::operator++(){
+  ++state;
+  ++index;
+  advanceState();
+  return *this;
+}
+
+World::AtomIterator World::AtomIterator::operator++(int){
+  AtomIterator res(*this);
+  ++(*this);
+  return res;
+}
+
+bool World::AtomIterator::operator==(const AtomIterator& rhs){
+  return state==rhs.state;
+}
+
+bool World::AtomIterator::operator==(const World::AtomSet::iterator& rhs){
+  return state==rhs;
+}
+
+bool World::AtomIterator::operator!=(const AtomIterator& rhs){
+  return state!=rhs.state;
+}
+
+bool World::AtomIterator::operator!=(const World::AtomSet::iterator& rhs){
+  return state!=rhs;
+}
+
+atom* World::AtomIterator::operator*(){
+  return (*state).second;
+}
+
+void World::AtomIterator::advanceState(){
+  while((state!=world->atoms.end()) && (!descr->predicate(*state))){
+    ++state;
+    ++index;
+  }
+}
+
+int World::AtomIterator::getCount(){
+  return index;
+}
