Index: src/Actions/FragmentationAction/DepthFirstSearchAction.cpp
===================================================================
--- src/Actions/FragmentationAction/DepthFirstSearchAction.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Actions/FragmentationAction/DepthFirstSearchAction.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -46,5 +46,5 @@
     molecule * const mol = World::getInstance().getMolecule(MoleculeById(0));
     MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
-    int *MinimumRingSize = new int[mol->AtomCount];
+    int *MinimumRingSize = new int[mol->getAtomCount()];
     atom ***ListOfLocalAtoms = NULL;
     class StackClass<bond *> *BackEdgeStack = NULL;
@@ -66,6 +66,6 @@
       delete(Subgraphs);
       for (int i=0;i<FragmentCounter;i++)
-        Free(&ListOfLocalAtoms[i]);
-      Free(&ListOfLocalAtoms);
+        delete[](ListOfLocalAtoms[i]);
+      delete[](ListOfLocalAtoms);
     }
     delete(BackEdgeStack);
Index: src/Actions/Makefile.am
===================================================================
--- src/Actions/Makefile.am	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Actions/Makefile.am	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -30,5 +30,6 @@
   ${TESSELATIONACTIONHEADER} \
   ${WORLDACTIONHEADER} \
-  MapOfActions.hpp
+  MapOfActions.hpp \
+  Values.hpp
   
 ANALYSISACTIONSOURCE = \
Index: src/Actions/MapOfActions.cpp
===================================================================
--- src/Actions/MapOfActions.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Actions/MapOfActions.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -12,7 +12,43 @@
 #include "Helpers/Assert.hpp"
 
+#include <boost/lexical_cast.hpp>
+#include <boost/optional.hpp>
+#include <boost/program_options.hpp>
+
 #include "CommandLineParser.hpp"
 #include "log.hpp"
 #include "verbose.hpp"
+
+#include "Actions/Values.hpp"
+
+void validate(boost::any& v, const std::vector<std::string>& values, VectorValue *, int)
+{
+  VectorValue VV;
+  if (values.size() != 3) {
+    cerr <<  "Specified vector does not have three components but " << values.size() << endl;
+    throw boost::program_options::validation_error("Specified vector does not have three components");
+  }
+  VV.x = boost::lexical_cast<double>(values.at(0));
+  VV.y = boost::lexical_cast<double>(values.at(1));
+  VV.z = boost::lexical_cast<double>(values.at(2));
+  v = boost::any(VectorValue(VV));
+}
+
+void validate(boost::any& v, const std::vector<std::string>& values, BoxValue *, int)
+{
+  BoxValue BV;
+  if (values.size() != 6) {
+    cerr <<  "Specified vector does not have three components but " << values.size() << endl;
+    throw boost::program_options::validation_error("Specified symmetric box matrix does not have six components");
+  }
+  BV.xx = boost::lexical_cast<double>(values.at(0));
+  BV.xy = boost::lexical_cast<double>(values.at(1));
+  BV.xz = boost::lexical_cast<double>(values.at(2));
+  BV.yy = boost::lexical_cast<double>(values.at(3));
+  BV.yz = boost::lexical_cast<double>(values.at(4));
+  BV.zz = boost::lexical_cast<double>(values.at(5));
+  v = boost::any(BoxValue(BV));
+}
+
 
 /** Constructor of class MapOfActions.
@@ -62,4 +98,5 @@
   DescriptionMap["save-bonds"] = "name of the bonds file to write to";
   DescriptionMap["save-temperature"] = "name of the temperature file to write to";
+  DescriptionMap["scale-box"] = "scale box and atomic positions inside";
   DescriptionMap["subspace-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs";
   DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified";
@@ -75,4 +112,5 @@
   DescriptionMap["distance"] = "distance in space";
   DescriptionMap["distances"] = "list of three of distances in space, one for each axis direction";
+  DescriptionMap["DoRotate"] = "whether to rotate or just report angles";
   DescriptionMap["element"] = "set of elements";
   DescriptionMap["end-mol"] = "last or end step";
@@ -92,5 +130,5 @@
   ShortFormMap["bond-file"] = "A";
   ShortFormMap["boundary"] = "c";
-  ShortFormMap["bound-in-box"] = "B";
+  ShortFormMap["change-box"] = "B";
   ShortFormMap["center-edge"] = "O";
   ShortFormMap["center-in-box"] = "b";
@@ -123,7 +161,7 @@
   ShortFormMap["suspend-in-water"] = "U";
   ShortFormMap["translate-mol"] = "t";
-  ShortFormMap["verbose"] = "V";
+  ShortFormMap["verbose"] = "v";
   ShortFormMap["verlet-integrate"] = "P";
-  ShortFormMap["version"] = "v";
+  ShortFormMap["version"] = "V";
 
   // value types for the actions
@@ -132,5 +170,6 @@
   TypeMap["bond-table"] = String;
   TypeMap["boundary"] = Vector;
-  TypeMap["change-box"] = Vector;
+  TypeMap["center-in-box"] = Box;
+  TypeMap["change-box"] = Box;
   TypeMap["change-element"] = Element;
   TypeMap["change-molname"] = String;
@@ -151,5 +190,5 @@
   TypeMap["remove-atom"] = Atom;
   TypeMap["remove-sphere"] = Atom;
-  TypeMap["repeat-box"] = ListOfInts;
+  TypeMap["repeat-box"] = Vector;
   TypeMap["rotate-to-pas"] = Molecule;
   TypeMap["save-adjacency"] = String;
@@ -163,4 +202,5 @@
   TypeMap["verlet-integrate"] = String;
   TypeMap["verbose"] = Integer;
+
   // value types for the values
   TypeMap["bin-output-file"] = String;
@@ -168,9 +208,10 @@
   TypeMap["bin-start"] = Double;
   TypeMap["distance"] = Double;
-  TypeMap["distances"] = ListOfDoubles;
+  TypeMap["distances"] = Vector;
+  TypeMap["DoRotate"] = Boolean;
   TypeMap["elements"] = Element;
   TypeMap["elements"] = ListOfElements;
   TypeMap["length"] = Double;
-  TypeMap["lengths"] = ListOfDoubles;
+  TypeMap["lengths"] = Vector;
   TypeMap["MaxDistance"] = Double;
   TypeMap["molecule-by-id"] = Molecule;
@@ -179,13 +220,17 @@
   TypeMap["position"] = Vector;
 
+  // default values for any action that needs one (always string!)
+  DefaultValue["molecule-by-id"] = "-1";
+
+
   // list of generic actions
 //	generic.insert("add-atom");
 //  generic.insert("bond-file");
 //	generic.insert("bond-table");
-//  generic.insert("boundary");
+  generic.insert("boundary");
 //  generic.insert("bound-in-box");
-//  generic.insert("center-edge");
-//  generic.insert("center-in-box");
-//	generic.insert("change-box");
+  generic.insert("center-edge");
+  generic.insert("center-in-box");
+	generic.insert("change-box");
 //  generic.insert("change-molname");
 //	generic.insert("change-element");
@@ -195,5 +240,5 @@
 //	generic.insert("element-db");
 //	generic.insert("fastparsing");
-//  generic.insert("fill-molecule");
+  generic.insert("fill-molecule");
 //  generic.insert("fragment-mol");
   generic.insert("help");
@@ -208,9 +253,10 @@
 //  generic.insert("remove-atom");
 //  generic.insert("remove-sphere");
+  generic.insert("repeat-box");
 //  generic.insert("rotate-to-pas");
 //	generic.insert("save-adjacency");
 //  generic.insert("save-bonds");
 //  generic.insert("save-temperature");
-//  generic.insert("scale-box");
+  generic.insert("scale-box");
 //  generic.insert("set-basis");
 //	generic.insert("subspace-dissect");
@@ -230,7 +276,4 @@
     generic.insert("input");
 //  generic.insert("length");
-//  generic.insert("lengths");
-//  generic.insert("MaxDistance");
-//  generic.insert("molecule-by-id");
 //  generic.insert("output-file");
 //  generic.insert("periodic");
@@ -240,4 +283,12 @@
     // positional arguments
     inputfile.insert("input");
+
+    // hidden arguments
+//  generic.insert("distance");
+    generic.insert("DoRotate");
+    generic.insert("distances");
+    generic.insert("lengths");
+    generic.insert("MaxDistance");
+    generic.insert("molecule-by-id");
 }
 
@@ -269,75 +320,121 @@
           case Boolean:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< bool >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< bool >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< bool >(),
+                  getDescription(*OptionRunner).c_str())
+              ;
+            break;
+          case Box:
+            ListRunner->second->add_options()
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value<BoxValue>()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Integer:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfInts:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<int> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Double:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< double >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< double >()->default_value(atof(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< double >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfDoubles:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<double> >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<double> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case String:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< std::string >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< std::string >()->default_value(DefaultValue[*OptionRunner]) :
+                        po::value< std::string >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Axis:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Vector:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<double> >(), getDescription(*OptionRunner).c_str())
-              ;
-            break;
-          case Box:
-            ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<double> >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value<VectorValue>()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Molecule:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfMolecules:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<int> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Atom:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfAtoms:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<int> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Element:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfElements:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<int> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
Index: src/Actions/MapOfActions.hpp
===================================================================
--- src/Actions/MapOfActions.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Actions/MapOfActions.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -53,4 +53,5 @@
 
   // map of the action names and their description
+  map<std::string, std::string> DefaultValue;
   map<std::string, std::string> DescriptionMap;
   map<std::string, std::string> ShortFormMap;
Index: src/Actions/MoleculeAction/FillWithMoleculeAction.cpp
===================================================================
--- src/Actions/MoleculeAction/FillWithMoleculeAction.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Actions/MoleculeAction/FillWithMoleculeAction.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -66,28 +66,29 @@
 
   if(dialog->display()) {
+    DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules, lengths(" << lengths[0] << "," << lengths[1] << "," << lengths[2] << "), distances (" << distances[0] << "," << distances[1] << "," << distances[2] << "), MaxDistance " << MaxDistance << ", DoRotate " << DoRotate << "." << endl);
     // construct water molecule
     molecule *filler = World::getInstance().createMolecule();
-//    if (!filler->AddXYZFile(filename)) {
-//      DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << filename << "." << endl);
-//    }
-//    filler->SetNameFromFilename(filename);
+    if (!filler->AddXYZFile(filename)) {
+      DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << filename << "." << endl);
+    }
+    filler->SetNameFromFilename(filename.c_str());
     molecule *Filling = NULL;
-    atom *first = NULL, *second = NULL, *third = NULL;
-    first = World::getInstance().createAtom();
-    first->type = World::getInstance().getPeriode()->FindElement(1);
-    first->x = Vector(0.441, -0.143, 0.);
-    filler->AddAtom(first);
-    second = World::getInstance().createAtom();
-    second->type = World::getInstance().getPeriode()->FindElement(1);
-    second->x = Vector(-0.464, 1.137, 0.0);
-    filler->AddAtom(second);
-    third = World::getInstance().createAtom();
-    third->type = World::getInstance().getPeriode()->FindElement(8);
-    third->x = Vector(-0.464, 0.177, 0.);
-    filler->AddAtom(third);
-    filler->AddBond(first, third, 1);
-    filler->AddBond(second, third, 1);
+//    atom *first = NULL, *second = NULL, *third = NULL;
+//    first = World::getInstance().createAtom();
+//    first->type = World::getInstance().getPeriode()->FindElement(1);
+//    first->x = Vector(0.441, -0.143, 0.);
+//    filler->AddAtom(first);
+//    second = World::getInstance().createAtom();
+//    second->type = World::getInstance().getPeriode()->FindElement(1);
+//    second->x = Vector(-0.464, 1.137, 0.0);
+//    filler->AddAtom(second);
+//    third = World::getInstance().createAtom();
+//    third->type = World::getInstance().getPeriode()->FindElement(8);
+//    third->x = Vector(-0.464, 0.177, 0.);
+//    filler->AddAtom(third);
+//    filler->AddBond(first, third, 1);
+//    filler->AddBond(second, third, 1);
     World::getInstance().getConfig()->BG->ConstructBondGraph(filler);
-    filler->SetNameFromFilename("water");
+//    filler->SetNameFromFilename("water");
     // call routine
     double distance[NDIM];
Index: src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp
===================================================================
--- src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -65,5 +65,5 @@
     DoLog(0) && (Log() << Verbose(0) << "Evaluating non-convex envelope of molecule." << Boundary->getId() << endl);
     DoLog(1) && (Log() << Verbose(1) << "Using rolling ball of radius " << SphereRadius << " and storing tecplot data in " << filename << "." << endl);
-    DoLog(1) && (Log() << Verbose(1) << "Specified molecule has " << Boundary->AtomCount << " atoms." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "Specified molecule has " << Boundary->getAtomCount() << " atoms." << endl);
     start = clock();
     LCList = new LinkedCell(Boundary, SphereRadius*2.);
Index: src/Actions/Values.hpp
===================================================================
--- src/Actions/Values.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
+++ src/Actions/Values.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -0,0 +1,29 @@
+/*
+ * Values.hpp
+ *
+ *  Created on: Jun 7, 2010
+ *      Author: heber
+ */
+
+#ifndef VALUES_HPP_
+#define VALUES_HPP_
+
+struct VectorValue
+{
+  double x;
+  double y;
+  double z;
+};
+
+struct BoxValue
+{
+  double xx;
+  double xy;
+  double xz;
+  double yy;
+  double yz;
+  double zz;
+};
+
+
+#endif /* VALUES_HPP_ */
Index: src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
===================================================================
--- src/Actions/WorldAction/AddEmptyBoundaryAction.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Actions/WorldAction/AddEmptyBoundaryAction.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -69,5 +69,5 @@
     AtomRunner = AllAtoms.begin();
     for (; AtomRunner != AllAtoms.end(); ++AtomRunner)
-      (*AtomRunner)->x -= Min;
+      (*AtomRunner)->x -= Min - boundary;
     delete dialog;
     return Action::success;
Index: src/Actions/WorldAction/CenterInBoxAction.cpp
===================================================================
--- src/Actions/WorldAction/CenterInBoxAction.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Actions/WorldAction/CenterInBoxAction.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -33,5 +33,6 @@
   Dialog *dialog = UIFactory::getInstance().makeDialog();
 
-  dialog->queryEmpty(NAME, MapOfActions::getInstance().getDescription(NAME));
+  double * cell_size = World::getInstance().getDomain();
+  dialog->queryBox(NAME, &cell_size, MapOfActions::getInstance().getDescription(NAME));
 
   if(dialog->display()) {
Index: src/Actions/WorldAction/RepeatBoxAction.cpp
===================================================================
--- src/Actions/WorldAction/RepeatBoxAction.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Actions/WorldAction/RepeatBoxAction.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -23,4 +23,6 @@
 #include "UIElements/Dialog.hpp"
 #include "Actions/MapOfActions.hpp"
+#include "Descriptors/MoleculeDescriptor.hpp"
+#include "Descriptors/MoleculePtrDescriptor.hpp"
 
 const char WorldRepeatBoxAction::NAME[] = "repeat-box";
@@ -40,13 +42,25 @@
   molecule *mol = NULL;
   int j = 0;
+  atom *Walker = NULL;
+  MoleculeListClass *molecules = World::getInstance().getMolecules();
 
   dialog->queryVector(NAME, &Repeater, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
-  dialog->queryMolecule("molecule-by-id", &mol,MapOfActions::getInstance().getDescription("molecule-by-id"));
+  //dialog->queryMolecule("molecule-by-id", &mol,MapOfActions::getInstance().getDescription("molecule-by-id"));
+  vector<molecule *> AllMolecules;
+  if (mol != NULL) {
+    DoLog(0) && (Log() << Verbose(0) << "Using molecule " << mol->name << "." << endl);
+    AllMolecules = World::getInstance().getAllMolecules(MoleculeByPtr(mol));
+  } else {
+    DoLog(0) && (Log() << Verbose(0) << "Using all molecules." << endl);
+    AllMolecules = World::getInstance().getAllMolecules();
+  }
 
   if(dialog->display()) {
+    (cout << "Repeating box " << Repeater << " times for (x,y,z) axis." << endl);
     double * const cell_size = World::getInstance().getDomain();
+    double *M = ReturnFullMatrixforSymmetric(cell_size);
     Vector x,y;
-    for (int axis = 1; axis <= NDIM; axis++) {
-      Vector ** vectors;
+    int n[NDIM];
+    for (int axis = 0; axis < NDIM; axis++) {
       Repeater[axis] = floor(Repeater[axis]);
       if (Repeater[axis] < 1) {
@@ -54,42 +68,54 @@
         Repeater[axis] = 1;
       }
-      mol->CountAtoms();  // recount atoms
-      if (mol->AtomCount != 0) {  // if there is more than none
-        count = mol->AtomCount;   // is changed becausing of adding, thus has to be stored away beforehand
-        Elements = new const element *[count];
-        vectors = new Vector *[count];
-        j = 0;
-        atom *first = mol->start;
-        while (first->next != mol->end) {  // make a list of all atoms with coordinates and element
-          first = first->next;
-          Elements[j] = first->type;
-          vectors[j] = &first->x;
-          j++;
-        }
-        if (count != j)
-          DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
-        x.Zero();
-        y.Zero();
-        y[abs(axis)-1] = cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
-        for (int i=1;i<Repeater[axis];i++) {  // then add this list with respective translation factor times
-          x += y; // per factor one cell width further
-          for (int k=count;k--;) { // go through every atom of the original cell
-            first = World::getInstance().createAtom(); // create a new body
-            first->x = (*vectors[k]) + x;
-            first->type = Elements[k];  // insert original element
-            mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
+      cell_size[(abs(axis+1) == 2) ? 2 : ((abs(axis+2) == 3) ? 5 : 0)] *= Repeater[axis];
+    }
+
+    molecule *newmol = NULL;
+    Vector ** vectors = NULL;
+    for (n[0] = 0; n[0] < Repeater[0]; n[0]++) {
+      y[0] = n[0];
+      for (n[1] = 0; n[1] < Repeater[1]; n[1]++) {
+        y[1] = n[1];
+        for (n[2] = 0; n[2] < Repeater[2]; n[2]++) {
+          y[2] = n[2];
+          if (n[0] == n[1] == n[2] == 0)
+            continue;
+          for (vector<molecule *>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
+            mol = *MolRunner;
+            DoLog(1) && (Log() << Verbose(1) << "Current mol is " << mol->name << "." << endl);
+            count = mol->getAtomCount();   // is changed becausing of adding, thus has to be stored away beforehand
+            if (count != 0) {  // if there is more than none
+              Elements = new const element *[count];
+              vectors = new Vector *[count];
+              j = 0;
+              for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
+                Elements[j] = (*AtomRunner)->type;
+                vectors[j] = &(*AtomRunner)->x;
+                j++;
+              }
+              if (count != j)
+                DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
+              x = y;
+              x.MatrixMultiplication(M);
+              newmol = World::getInstance().createMolecule();
+              molecules->insert(newmol);
+              for (int k=count;k--;) { // go through every atom of the original cell
+                Walker = World::getInstance().createAtom(); // create a new body
+                Walker->x = (*vectors[k]) + x;
+                Walker->type = Elements[k];  // insert original element
+                cout << "new atom is " << *Walker << endl;
+                newmol->AddAtom(Walker);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
+              }
+              // free memory
+              delete[](Elements);
+              delete[](vectors);
+            } else {
+              DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl);
+            }
           }
         }
-        // free memory
-        delete[](Elements);
-        delete[](vectors);
-        // correct cell size
-        if (axis < 0) { // if sign was negative, we have to translate everything
-          x =(-(Repeater[axis]-1)) * y;
-          mol->Translate(&x);
-        }
-        cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= Repeater[axis];
       }
     }
+    delete(M);
     delete dialog;
     return Action::success;
Index: src/Descriptors/MoleculePtrDescriptor.cpp
===================================================================
--- src/Descriptors/MoleculePtrDescriptor.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
+++ src/Descriptors/MoleculePtrDescriptor.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -0,0 +1,40 @@
+/*
+ * MoleculePtrDescriptor.cpp
+ *
+ *  Created on: Feb 5, 2010
+ *      Author: crueger
+ */
+
+#include "MoleculePtrDescriptor.hpp"
+#include "MoleculePtrDescriptor_impl.hpp"
+
+#include "molecule.hpp"
+
+using namespace std;
+
+
+MoleculePtrDescriptor_impl::MoleculePtrDescriptor_impl(molecule * _ptr) :
+  ptr(_ptr)
+{}
+
+MoleculePtrDescriptor_impl::~MoleculePtrDescriptor_impl()
+{}
+
+bool MoleculePtrDescriptor_impl::predicate(std::pair<moleculeId_t,molecule*> molecule) {
+  return molecule.second==ptr;
+}
+
+MoleculeDescriptor MoleculeByPtr(molecule * ptr){
+  return MoleculeDescriptor(MoleculeDescriptor::impl_ptr(new MoleculePtrDescriptor_impl(ptr)));
+}
+
+molecule *MoleculePtrDescriptor_impl::find(){
+  World::MoleculeSet molecules = getMolecules();
+  World::MoleculeSet::iterator res = molecules.find(ptr->getId());
+  return (res!=molecules.end())?((*res).second):0;
+}
+
+vector<molecule*> MoleculePtrDescriptor_impl::findAll(){
+  molecule *res = find();
+  return (res)?(vector<molecule*>(1,res)):(vector<molecule*>());
+}
Index: src/Descriptors/MoleculePtrDescriptor.hpp
===================================================================
--- src/Descriptors/MoleculePtrDescriptor.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
+++ src/Descriptors/MoleculePtrDescriptor.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -0,0 +1,16 @@
+/*
+ * MoleculeIdDescriptor.hpp
+ *
+ *  Created on: Feb 5, 2010
+ *      Author: crueger
+ */
+
+#ifndef MOLECULEPTRDESCRIPTOR_HPP_
+#define MOLECULEPTRDESCRIPTOR_HPP_
+
+#include "defs.hpp"
+#include "Descriptors/MoleculeDescriptor.hpp"
+
+MoleculeDescriptor MoleculeByPtr(molecule * ptr);
+
+#endif /* MOLECULEPTRDESCRIPTOR_HPP_ */
Index: src/Descriptors/MoleculePtrDescriptor_impl.hpp
===================================================================
--- src/Descriptors/MoleculePtrDescriptor_impl.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
+++ src/Descriptors/MoleculePtrDescriptor_impl.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -0,0 +1,23 @@
+#ifndef MOLECULEPTRDESCRIPTOR_IMPL_HPP
+#define MOLECULEPTRDESCRIPTOR_IMPL_HPP
+
+#include "Descriptors/MoleculeDescriptor_impl.hpp"
+
+class molecule;
+
+class MoleculePtrDescriptor_impl : public MoleculeDescriptor_impl
+{
+public:
+  MoleculePtrDescriptor_impl(molecule * ptr);
+  virtual ~MoleculePtrDescriptor_impl();
+
+  bool predicate(std::pair<moleculeId_t,molecule*> molecule);
+
+protected:
+  virtual molecule *find();
+  virtual std::vector<molecule*> findAll();
+private:
+  molecule * ptr;
+};
+
+#endif //MOLECULEPTRDESCRIPTOR_IMPL_HPP
Index: src/Helpers/Assert.cpp
===================================================================
--- src/Helpers/Assert.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Helpers/Assert.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -54,5 +54,4 @@
 
 
-
 bool _my_assert::check(const bool res,
                        const char* condition,
@@ -63,5 +62,5 @@
 {
   if(!res){
-    cout << "Assertion " << condition << " failed in file " << filename << " at line " << line << endl;
+    cout << "Assertion \"" << condition << "\" failed in file " << filename << " at line " << line << endl;
     cout << "Assertion Message: " << message << std::endl;
     while(true){
Index: src/Helpers/MemDebug.cpp
===================================================================
--- src/Helpers/MemDebug.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Helpers/MemDebug.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -9,6 +9,10 @@
 #include <cstdlib>
 #include <cstring>
+#include <boost/thread.hpp>
 
 using namespace std;
+
+#ifndef NDBEGUG
+#ifndef NO_MEMDEBUG
 
 namespace Memory {
@@ -40,4 +44,6 @@
   };
 
+  boost::mutex memorylock;
+
   // start and end of the doubly-linked list
   entry_t *begin=0;
@@ -128,4 +134,7 @@
 void *operator new(size_t nbytes,const char* file, int line) throw(std::bad_alloc) {
 
+  // we need to lock, so that no one changes the linked list while we are here
+  boost::mutex::scoped_lock guard(Memory::memorylock);
+
   // to avoid allocations of 0 bytes if someone screws up
   // allocation with 0 byte size are undefined behavior, so we are
@@ -153,4 +162,5 @@
   // build the entry in front of the space
   Memory::entry_t *entry = (Memory::entry_t*) res;
+  memset(res,0,entrySpace);
   entry->info.nbytes = nbytes;
   entry->info.isUsed = true;
@@ -203,4 +213,12 @@
 
 void operator delete(void *ptr) throw() {
+  if(!ptr){
+    cerr << "Warning: Deleting NULL pointer" << endl;
+    return;
+  }
+
+  // we need to lock, so the linked list does not changed while we are in here
+  boost::mutex::scoped_lock guard(Memory::memorylock);
+
   // get the size for the entry, including alignment
   static const size_t entrySpace = Memory::doAlign(sizeof(Memory::entry_t));
@@ -211,7 +229,7 @@
   // let's see if the checksum is still matching
   if(Memory::calcChecksum(&entry->info)!=entry->checksum){
-    cout << "Possible memory corruption detected!" << endl;
-    cout << "Trying to recover allocation information..." << endl;
-    cout << "Memory was allocated at " << entry->info.file << ":" << entry->info.line << endl;
+    cerr << "Possible memory corruption detected!" << endl;
+    cerr << "Trying to recover allocation information..." << endl;
+    cerr << "Memory was allocated at " << entry->info.file << ":" << entry->info.line << endl;
     terminate();
   }
@@ -240,2 +258,4 @@
   operator delete(ptr);
 }
+#endif
+#endif
Index: src/Helpers/MemDebug.hpp
===================================================================
--- src/Helpers/MemDebug.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Helpers/MemDebug.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -21,4 +21,10 @@
  * your sourcefiles.
  */
+#ifndef NDEBUG
+#ifndef NO_MEMDEBUG
+
+#ifndef MEMDEBUG
+#define MEMDEBUG
+#endif
 
 namespace Memory {
@@ -56,3 +62,20 @@
 #define new new(__FILE__,__LINE__)
 
+#endif
+#endif
+
+
+#ifndef MEMDEBUG
+// memory debugging was disabled
+
+namespace Memory {
+  inline void getState(){}
+
+  template <typename T>
+  inline T *ignore(T* ptr){
+    return ptr;
+  }
+}
+
+#endif
 #endif /* MEMDEBUG_HPP_ */
Index: src/Legacy/oldmenu.cpp
===================================================================
--- src/Legacy/oldmenu.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Legacy/oldmenu.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -424,5 +424,5 @@
 void oldmenu::RemoveAtoms(molecule *mol)
 {
-  atom *first, *second;
+  atom *second;
   int axis;
   double tmp1, tmp2;
@@ -447,14 +447,14 @@
       break;
     case 'b':
-      second = mol->AskAtom("Enter number of atom as reference point: ");
-      Log() << Verbose(0) << "Enter radius: ";
-      cin >> tmp1;
-      first = mol->start;
-      second = first->next;
-      while(second != mol->end) {
-        first = second;
-        second = first->next;
-        if (first->x.DistanceSquared(second->x) > tmp1*tmp1) // distance to first above radius ...
-          mol->RemoveAtom(first);
+      {
+        second = mol->AskAtom("Enter number of atom as reference point: ");
+        Log() << Verbose(0) << "Enter radius: ";
+        cin >> tmp1;
+        molecule::iterator runner;
+        for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
+          runner = iter++;
+          if ((*runner)->x.DistanceSquared((*runner)->x) > tmp1*tmp1) // distance to first above radius ...
+            mol->RemoveAtom((*runner));
+        }
       }
       break;
@@ -466,12 +466,10 @@
       Log() << Verbose(0) << "Upper boundary: ";
       cin >> tmp2;
-      first = mol->start;
-      second = first->next;
-      while(second != mol->end) {
-        first = second;
-        second = first->next;
-        if ((first->x[axis] < tmp1) || (first->x[axis] > tmp2)) {// out of boundary ...
-          //Log() << Verbose(0) << "Atom " << *first << " with " << first->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
-          mol->RemoveAtom(first);
+      molecule::iterator runner;
+      for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
+        runner = iter++;
+        if (((*runner)->x[axis] < tmp1) || ((*runner)->x[axis] > tmp2)) {// out of boundary ...
+          //Log() << Verbose(0) << "Atom " << *(*runner) << " with " << (*runner)->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
+          mol->RemoveAtom((*runner));
         }
       }
@@ -516,15 +514,13 @@
         min[i] = 0.;
 
-      second = mol->start;
-      while ((second->next != mol->end)) {
-        second = second->next; // advance
-        Z = second->type->Z;
+      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+        Z = (*iter)->type->Z;
         tmp1 = 0.;
-        if (first != second) {
-          x = first->x - second->x;
+        if (first != (*iter)) {
+          x = first->x - (*iter)->x;
           tmp1 = x.Norm();
         }
         if ((tmp1 != 0.) && ((min[Z] == 0.) || (tmp1 < min[Z]))) min[Z] = tmp1;
-        //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << second->nr << ": " << tmp1 << " a.u." << endl;
+        //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << ((*iter)->nr << ": " << tmp1 << " a.u." << endl;
       }
       for (int i=MAX_ELEMENTS;i--;)
@@ -609,5 +605,5 @@
   Log() << Verbose(0) << "What's the desired bond order: ";
   cin >> Order1;
-  if (mol->first->next != mol->last) {  // there are bonds
+  if (mol->hasBondStructure()) {
     start = clock();
     mol->FragmentMolecule(Order1, configuration);
@@ -755,16 +751,12 @@
     Log() << Verbose(0) << "State the factor: ";
     cin >> faktor;
-
-    mol->CountAtoms(); // recount atoms
-    if (mol->AtomCount != 0) {  // if there is more than none
-      count = mol->AtomCount;  // is changed becausing of adding, thus has to be stored away beforehand
+    if (mol->getAtomCount() != 0) {  // if there is more than none
+      count = mol->getAtomCount();  // is changed becausing of adding, thus has to be stored away beforehand
       Elements = new const element *[count];
       vectors = new Vector *[count];
       j = 0;
-      first = mol->start;
-      while (first->next != mol->end) { // make a list of all atoms with coordinates and element
-        first = first->next;
-        Elements[j] = first->type;
-        vectors[j] = &first->x;
+      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+        Elements[j] = (*iter)->type;
+        vectors[j] = &(*iter)->x;
         j++;
       }
@@ -783,5 +775,5 @@
         }
       }
-      if (mol->first->next != mol->last) // if connect matrix is present already, redo it
+      if (mol->hasBondStructure())
         mol->CreateAdjacencyList(mol->BondDistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
       // free memory
@@ -1025,14 +1017,12 @@
     return;
   }
-  atom *Walker = mol->start;
 
   // generate some KeySets
   Log() << Verbose(0) << "Generating KeySets." << endl;
-  KeySet TestSets[mol->AtomCount+1];
+  KeySet TestSets[mol->getAtomCount()+1];
   i=1;
-  while (Walker->next != mol->end) {
-    Walker = Walker->next;
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     for (int j=0;j<i;j++) {
-      TestSets[j].insert(Walker->nr);
+      TestSets[j].insert((*iter)->nr);
     }
     i++;
@@ -1040,12 +1030,15 @@
   Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl;
   KeySetTestPair test;
-  test = TestSets[mol->AtomCount-1].insert(Walker->nr);
-  if (test.second) {
-    Log() << Verbose(1) << "Insertion worked?!" << endl;
+  molecule::const_iterator iter = mol->begin();
+  if (iter != mol->end()) {
+    test = TestSets[mol->getAtomCount()-1].insert((*iter)->nr);
+    if (test.second) {
+      Log() << Verbose(1) << "Insertion worked?!" << endl;
+    } else {
+      Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
+    }
   } else {
-    Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
-  }
-  TestSets[mol->AtomCount].insert(mol->end->previous->nr);
-  TestSets[mol->AtomCount].insert(mol->end->previous->previous->previous->nr);
+    eLog() << Verbose(1) << "No atoms to test double insertion." << endl;
+  }
 
   // constructing Graph structure
@@ -1055,10 +1048,10 @@
   // insert KeySets into Subgraphs
   Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;
-  for (int j=0;j<mol->AtomCount;j++) {
+  for (int j=0;j<mol->getAtomCount();j++) {
     Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
   }
   Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl;
   GraphTestPair test2;
-  test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.)));
+  test2 = Subgraphs.insert(GraphPair (TestSets[mol->getAtomCount()],pair<int, double>(counter++, 1.)));
   if (test2.second) {
     Log() << Verbose(1) << "Insertion worked?!" << endl;
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Makefile.am	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -113,12 +113,14 @@
   Descriptors/AtomTypeDescriptor.cpp \
   Descriptors/MoleculeDescriptor.cpp \
-  Descriptors/MoleculeIdDescriptor.cpp 
+  Descriptors/MoleculeIdDescriptor.cpp \ 
+  Descriptors/MoleculePtrDescriptor.cpp 
 				   
-				   
+
 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp \
   Descriptors/AtomIdDescriptor.hpp \
   Descriptors/AtomTypeDescriptor.hpp \
   Descriptors/MoleculeDescriptor.hpp \
-  Descriptors/MoleculeIdDescriptor.hpp
+  Descriptors/MoleculeIdDescriptor.hpp \
+  Descriptors/MoleculePtrDescriptor.hpp
 				   
 EXCEPTIONSOURCE = Exceptions/CustomException.cpp \
@@ -157,8 +159,6 @@
   Line.cpp \
   linkedcell.cpp \
-  lists.cpp \
   log.cpp \
   logger.cpp \
-  memoryusageobserver.cpp \
   moleculelist.cpp \
   molecule.cpp \
@@ -171,9 +171,11 @@
   periodentafel.cpp \
   Plane.cpp \
+  Space.cpp \
   tesselation.cpp \
   tesselationhelpers.cpp \
   triangleintersectionlist.cpp \
+  vector.cpp \
+  vector_ops.cpp \
   verbose.cpp \
-  vector_ops.cpp \
   World.cpp
 
@@ -206,6 +208,4 @@
   log.hpp \
   logger.hpp \
-  memoryallocator.hpp \
-  memoryusageobserver.hpp \
   molecule.hpp \
   molecule_template.hpp \
@@ -221,4 +221,10 @@
   World.hpp 
 
+# the following files are no longer used:
+#  memoryallocator.hpp \
+#  memoryallocator.cpp \
+#  memoryusageobserver.hpp \
+#  memoryusageobserver.cpp
+
 BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
 INCLUDES = -I$(top_srcdir)/src/unittests -I$(top_srcdir)/src/Actions -I$(top_srcdir)/src/UIElements
Index: src/Patterns/Cacheable.hpp
===================================================================
--- src/Patterns/Cacheable.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Patterns/Cacheable.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -28,5 +28,5 @@
         owner(_owner)
         {}
-      virtual T getValue()=0;
+      virtual T& getValue()=0;
       virtual void invalidate()=0;
       virtual bool isValid()=0;
@@ -46,5 +46,5 @@
         {}
 
-      virtual T getValue(){
+      virtual T& getValue(){
         // set the state to valid
         State::owner->switchState(State::owner->validState);
@@ -72,5 +72,5 @@
         {}
 
-      virtual T getValue(){
+      virtual T& getValue(){
         return content;
       }
@@ -100,5 +100,5 @@
         {}
 
-      virtual T getValue(){
+      virtual T& getValue(){
         ASSERT(0,"Cannot get a value from a Cacheable after it's Observable has died");
         // we have to return a grossly invalid reference, because no value can be produced anymore
@@ -134,5 +134,4 @@
     void subjectKilled(Observable *subject);
   private:
-
     void switchState(state_ptr newState);
 
@@ -144,5 +143,4 @@
 
     Observable *owner;
-
     boost::function<T()> recalcMethod;
 
@@ -221,5 +219,5 @@
 
     const bool isValid() const;
-    const T operator*() const;
+    const T& operator*() const;
 
     // methods implemented for base-class Observer
@@ -237,5 +235,5 @@
 
   template<typename T>
-  const T Cacheable<T>::operator*() const{
+  const T& Cacheable<T>::operator*() const{
     return recalcMethod();
   }
Index: src/Patterns/ObservedIterator.hpp
===================================================================
--- src/Patterns/ObservedIterator.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
+++ src/Patterns/ObservedIterator.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -0,0 +1,144 @@
+/*
+ * ObservedIterator.hpp
+ *
+ *  Created on: Mar 4, 2010
+ *      Author: crueger
+ */
+
+#ifndef OBSERVEDITERATOR_HPP_
+#define OBSERVEDITERATOR_HPP_
+
+#include "Patterns/Observer.hpp"
+
+#include <iterator>
+
+// we build an iterator that observes traversion of some kind of Data structure conforming to STL
+template<class _Set>
+class ObservedIterator
+    : public std::iterator<typename std::iterator_traits<typename _Set::iterator>::iterator_category,
+                           typename std::iterator_traits<typename _Set::iterator>::value_type,
+                           typename std::iterator_traits<typename _Set::iterator>::difference_type,
+                           typename std::iterator_traits<typename _Set::iterator>::pointer,
+                           typename std::iterator_traits<typename _Set::iterator>::reference>
+{
+public:
+  // Some typedefs to conform to STL-Iterator structure
+  typedef typename _Set::iterator _Iter;
+  typedef typename _Iter::value_type value_type;
+  typedef typename _Iter::difference_type difference_type;
+  typedef typename _Iter::pointer pointer;
+  typedef typename _Iter::reference reference;
+  typedef typename _Iter::iterator_category iterator_category;
+
+  ObservedIterator() :
+    protector(0)
+  {}
+
+  ObservedIterator(_Iter iter,Observable *obs) :
+    iter(iter),
+    collection(obs),
+    protector(0)
+  {}
+
+  ObservedIterator(const ObservedIterator &dest) :
+    iter(dest.iter),
+    collection(dest.collection),
+    protector(dest.copyLock())
+  {}
+
+  ~ObservedIterator(){
+    if(protector)
+      delete protector;
+  }
+
+  // standard Iterator methods
+  ObservedIterator& operator=(const ObservedIterator& dest){
+    if(&dest !=this){
+      // get the new lock first, in case the two locks point to the same observable
+      Observable::_Observable_protector *newLock = dest.copyLock();
+      if(protector)
+        delete protector;
+      protector = newLock;
+      // After the new lock is aquired we can safely set the iterator
+      iter = dest.iter;
+      // we need to know the collection, in case we still have to set the lock
+      collection = dest.collection;
+    }
+    return *this;
+  }
+
+  ObservedIterator& operator++()   // prefix
+  {
+    ++iter;
+    return *this;
+  }
+
+  ObservedIterator operator++(int) // postfix with the dummy int parameter
+  {
+    ObservedIterator ret(*this);
+    ++(*this);
+    return ret;
+  }
+
+  ObservedIterator& operator--()   // prefix
+  {
+    --iter;
+  }
+
+  ObservedIterator  operator--(int) // postfix with the dummy int parameter
+  {
+    ObservedIterator ret(*this);
+    --(*this);
+    return ret;
+  }
+
+  bool operator==(const ObservedIterator &rhs){
+    return iter==rhs.iter;
+  }
+
+  bool operator!=(const ObservedIterator &rhs){
+    return iter!=rhs.iter;
+  }
+
+  value_type operator*(){
+    // access is requested... time to get the lock
+    acquireLock();
+    return (*iter);
+  }
+
+  // when we turn into a const iterator we can loose our lock
+  operator typename _Set::const_iterator() {
+    // typecast will be handled by the typecast method of the original iterator
+    return iter;
+  }
+
+private:
+
+  /**
+   * gets the lock for the collection when needed
+   *
+   * The lock is only acquired when the first change is done, so we can be free to do
+   * anything with the iterator before that. I.e. step forward, turn into a const_iterator
+   * etc.
+   */
+  void acquireLock(){
+    if(!protector)
+      protector = new Observable::_Observable_protector(collection);
+  }
+
+  Observable::_Observable_protector *copyLock() const{
+    // we only copy if we actually carry a lock
+    if(protector){
+      return new Observable::_Observable_protector(*protector);
+    }
+    else{
+      return 0;
+    }
+  }
+
+  _Iter iter;
+  Observable *collection;
+  Observable::_Observable_protector *protector;
+};
+
+#endif /* OBSERVEDITERATOR_HPP_ */
Index: src/Patterns/Observer.cpp
===================================================================
--- src/Patterns/Observer.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Patterns/Observer.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -82,4 +82,10 @@
 Observable::_Observable_protector::_Observable_protector(Observable *_protege) :
   protege(_protege)
+{
+  start_observer_internal(protege);
+}
+
+Observable::_Observable_protector::_Observable_protector(const _Observable_protector &dest) :
+    protege(dest.protege)
 {
   start_observer_internal(protege);
@@ -189,4 +195,5 @@
   ASSERT(callTable.count(this),"SignOff called for an Observable without Observers.");
   callees_t &callees = callTable[this];
+
   callees_t::iterator iter;
   callees_t::iterator deliter;
Index: src/Patterns/Observer.hpp
===================================================================
--- src/Patterns/Observer.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Patterns/Observer.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -36,4 +36,7 @@
 typedef Notification *const Notification_ptr;
 
+template<class _Set>
+class ObservedIterator;
+
 /**
  * An Observer is notified by all Observed objects, when anything changes.
@@ -53,4 +56,6 @@
   friend class Observable;
   friend class Notification;
+  template<class> friend class ObservedIterator;
+
 public:
   Observer();
@@ -152,5 +157,4 @@
   static std::set<Observable*> busyObservables;
 
-
   //! @cond
   // Structure for RAII-Style notification
@@ -164,4 +168,5 @@
   public:
     _Observable_protector(Observable *);
+    _Observable_protector(const _Observable_protector&);
     ~_Observable_protector();
   private:
Index: src/Plane.cpp
===================================================================
--- src/Plane.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Plane.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -91,4 +91,13 @@
   offset = normalVector->ScalarProduct(_offsetVector);
 }
+
+/**
+ * copy constructor
+ */
+Plane::Plane(const Plane& plane) :
+  normalVector(new Vector(*plane.normalVector)),
+  offset(plane.offset)
+{}
+
 
 Plane::~Plane()
Index: src/Plane.hpp
===================================================================
--- src/Plane.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/Plane.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -26,4 +26,5 @@
   Plane(const Vector &_normalVector, double _offset)  throw(ZeroVectorException);
   Plane(const Vector &_normalVector, const Vector &_offsetVector) throw(ZeroVectorException);
+  Plane(const Plane& plane);
   virtual ~Plane();
 
Index: src/UIElements/CommandLineUI/CommandLineDialog.cpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineDialog.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/UIElements/CommandLineUI/CommandLineDialog.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -15,4 +15,6 @@
 #include <Descriptors/MoleculeIdDescriptor.hpp>
 #include "CommandLineUI/CommandLineDialog.hpp"
+
+#include "Actions/Values.hpp"
 
 #include "element.hpp"
@@ -116,24 +118,9 @@
 
 bool CommandLineDialog::BooleanCommandLineQuery::handle() {
-  bool badInput = false;
-  char input = ' ';
-  do{
-    badInput = false;
-    Log() << Verbose(0) << getTitle();
-    cin >> input;
-    if ((input == 'y' ) || (input == 'Y')) {
-      tmp = true;
-    } else if ((input == 'n' ) || (input == 'N')) {
-      tmp = false;
-    } else {
-      badInput=true;
-      cin.clear();
-      cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
-      Log() << Verbose(0) << "Input was not of [yYnN]!" << endl;
-    }
-  } while(badInput);
-  // clear the input buffer of anything still in the line
-  cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
-  return true;
+  if (CommandLineParser::getInstance().vm.count(getTitle())) {
+    tmp = CommandLineParser::getInstance().vm[getTitle()].as<bool>();
+    return true;
+  } else
+    return false;
 }
 
@@ -192,5 +179,9 @@
   if (CommandLineParser::getInstance().vm.count(getTitle())) {
     IdxOfMol = CommandLineParser::getInstance().vm[getTitle()].as<int>();
-    tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol));
+    cout << "IdxOfMol " << IdxOfMol << endl;
+    if (IdxOfMol >= 0)
+      tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol));
+    else
+      tmp = NULL;
     return true;
   } else
@@ -206,10 +197,10 @@
 
 bool CommandLineDialog::VectorCommandLineQuery::handle() {
-  vector<double> temp;
-  if (CommandLineParser::getInstance().vm.count(getTitle())) {
-    temp = CommandLineParser::getInstance().vm[getTitle()].as<vector<double> >();
-    assert((temp.size() == 3) && "Vector from command line does not have three components.");
-    for (int i=0;i<NDIM;i++)
-      tmp->at(i) = temp[i];
+  VectorValue temp;
+  if (CommandLineParser::getInstance().vm.count(getTitle())) {
+    temp = CommandLineParser::getInstance().vm[getTitle()].as< VectorValue >();
+    tmp->at(0) = temp.x;
+    tmp->at(1) = temp.y;
+    tmp->at(2) = temp.z;
     return true;
   } else
@@ -226,10 +217,13 @@
 
 bool CommandLineDialog::BoxCommandLineQuery::handle() {
-  vector<double> temp;
-  if (CommandLineParser::getInstance().vm.count(getTitle())) {
-    temp = CommandLineParser::getInstance().vm[getTitle()].as<vector<double> >();
-    assert((temp.size() == 6) && "Symmetric box matrix from command line does not have six components.");
-    for (int i=0;i<6;i++)
-      tmp[i] = temp[i];
+  BoxValue temp;
+  if (CommandLineParser::getInstance().vm.count(getTitle())) {
+    temp = CommandLineParser::getInstance().vm[getTitle()].as< BoxValue >();
+    tmp[0] = temp.xx;
+    tmp[1] = temp.xy;
+    tmp[2] = temp.xz;
+    tmp[3] = temp.yy;
+    tmp[4] = temp.yz;
+    tmp[5] = temp.zz;
     return true;
   } else
Index: src/UIElements/CommandLineUI/CommandLineWindow.cpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineWindow.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/UIElements/CommandLineUI/CommandLineWindow.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -73,9 +73,9 @@
 CommandLineWindow::~CommandLineWindow()
 {
-  // go through all possible actions
-  for(std::map<const std::string,Action*>::iterator ActionRunner = ActionRegistry::getInstance().getBeginIter(); ActionRegistry::getInstance().getBeginIter() != ActionRegistry::getInstance().getEndIter(); ActionRunner = ActionRegistry::getInstance().getBeginIter()) {
-    ActionRegistry::getInstance().unregisterAction(ActionRunner->second);
-    delete(ActionRunner->second);
-  }
+//  // go through all possible actions
+//  for(std::map<const std::string,Action*>::iterator ActionRunner = ActionRegistry::getInstance().getBeginIter(); ActionRegistry::getInstance().getBeginIter() != ActionRegistry::getInstance().getEndIter(); ActionRunner = ActionRegistry::getInstance().getBeginIter()) {
+//    ActionRegistry::getInstance().unregisterAction(ActionRunner->second);
+//    delete(ActionRunner->second);
+//  }
 
   delete statusIndicator;
Index: src/UIElements/Dialog.cpp
===================================================================
--- src/UIElements/Dialog.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/UIElements/Dialog.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -166,5 +166,5 @@
   target(_target)
 {
-tmp = new Vector();
+  tmp = new Vector();
 }
 
@@ -193,6 +193,7 @@
 
 void Dialog::BoxQuery::setResult() {
-  for (int i=0;i<6;i++)
-    *target[i] = tmp[i];
+  for (int i=0;i<6;i++) {
+    (*target)[i] = tmp[i];
+  }
 }
 
Index: src/World.cpp
===================================================================
--- src/World.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/World.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -87,9 +87,11 @@
   delete[](defaultName);
   const int length = strlen(name);
-  defaultName = new char[length+2];
-  if (length < MAXSTRINGSIZE)
+  if (length < MAXSTRINGSIZE) {
+    defaultName = new char[length+2];
     strncpy(defaultName, name, length);
-  else
-    strcpy(defaultName, "none");
+  } else {
+    defaultName = new char[MAXSTRINGSIZE];
+    strncpy(defaultName, "none", MAXSTRINGSIZE-1);
+  }
 };
 
Index: src/analysis_bonds.cpp
===================================================================
--- src/analysis_bonds.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/analysis_bonds.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -26,9 +26,7 @@
   Mean = 0.;
 
-  atom *Walker = mol->start;
   int AtomCount = 0;
-  while (Walker->next != mol->end) {
-    Walker = Walker->next;
-    const int count = Walker->ListOfBonds.size();
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    const int count = (*iter)->ListOfBonds.size();
     if (Max < count)
       Max = count;
@@ -58,10 +56,8 @@
 
   int AtomNo = 0;
-  atom *Walker = mol->start;
-  while (Walker->next != mol->end) {
-    Walker = Walker->next;
-    if (Walker->type == type1)
-      for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++)
-        if ((*BondRunner)->GetOtherAtom(Walker)->type == type2) {
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    if ((*iter)->type == type1)
+      for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++)
+        if ((*BondRunner)->GetOtherAtom((*iter))->type == type2) {
           const double distance = (*BondRunner)->GetDistanceSquared();
           if (Min > distance)
@@ -126,6 +122,4 @@
 int CountHydrogenBridgeBonds(MoleculeListClass *molecules, const element * InterfaceElement = NULL)
 {
-  atom *Walker = NULL;
-  atom *Runner = NULL;
   int count = 0;
   int OtherHydrogens = 0;
@@ -133,15 +127,13 @@
   bool InterfaceFlag = false;
   bool OtherHydrogenFlag = true;
-  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) {
-    Walker = (*MolWalker)->start;
-    while (Walker->next != (*MolWalker)->end) {
-      Walker = Walker->next;
-      for (MoleculeList::const_iterator MolRunner = molecules->ListOfMolecules.begin();MolRunner != molecules->ListOfMolecules.end(); MolRunner++) {
-        Runner = (*MolRunner)->start;
-        while (Runner->next != (*MolRunner)->end) {
-          Runner = Runner->next;
-          if ((Walker->type->Z  == 8) && (Runner->type->Z  == 8)) {
+  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); ++MolWalker) {
+    molecule::iterator Walker = (*MolWalker)->begin();
+    for(;Walker!=(*MolWalker)->end();++Walker){
+      for (MoleculeList::const_iterator MolRunner = molecules->ListOfMolecules.begin();MolRunner != molecules->ListOfMolecules.end(); ++MolRunner) {
+        molecule::iterator Runner = (*MolRunner)->begin();
+        for(;Runner!=(*MolRunner)->end();++Runner){
+          if (((*Walker)->type->Z  == 8) && ((*Runner)->type->Z  == 8)) {
             // check distance
-            const double distance = Runner->x.DistanceSquared(Walker->x);
+            const double distance = (*Runner)->x.DistanceSquared((*Walker)->x);
             if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means  different atoms
               // on other atom(Runner) we check for bond to interface element and
@@ -151,9 +143,9 @@
               OtherHydrogens = 0;
               InterfaceFlag = (InterfaceElement == NULL);
-              for (BondList::const_iterator BondRunner = Runner->ListOfBonds.begin(); BondRunner != Runner->ListOfBonds.end(); BondRunner++) {
-                atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Runner);
+              for (BondList::const_iterator BondRunner = (*Runner)->ListOfBonds.begin(); BondRunner != (*Runner)->ListOfBonds.end(); BondRunner++) {
+                atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner);
                 // if hydrogen, check angle to be greater(!) than 30 degrees
                 if (OtherAtom->type->Z == 1) {
-                  const double angle = CalculateAngle(&OtherAtom->x, &Runner->x, &Walker->x);
+                  const double angle = CalculateAngle(&OtherAtom->x, &(*Runner)->x, &(*Walker)->x);
                   OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON);
                   Otherangle += angle;
@@ -176,10 +168,10 @@
               if (InterfaceFlag && OtherHydrogenFlag) {
                 // on this element (Walker) we check for bond to hydrogen, i.e. part of water molecule
-                for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {
-                  atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Walker);
+                for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) {
+                  atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker);
                   if (OtherAtom->type->Z == 1) {
                     // check angle
-                    if (CheckHydrogenBridgeBondAngle(Walker, OtherAtom, Runner)) {
-                      DoLog(1) && (Log() << Verbose(1) << Walker->Name << ", " << OtherAtom->Name << " and " << Runner->Name << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(&OtherAtom->x, &Walker->x, &Runner->x)*(180./M_PI) << "." << endl);
+                    if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) {
+                      DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(&OtherAtom->x, &(*Walker)->x, &(*Runner)->x)*(180./M_PI) << "." << endl);
                       count++;
                       break;
@@ -205,15 +197,14 @@
 int CountBondsOfTwo(MoleculeListClass * const molecules, const element * const first, const element * const second)
 {
-  atom *Walker = NULL;
   int count = 0;
 
   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) {
-    Walker = (*MolWalker)->start;
-    while (Walker->next != (*MolWalker)->end) {
-      Walker = Walker->next;
-      if ((Walker->type == first) || (Walker->type == second)) {  // first element matches
-        for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {
-          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Walker);
-          if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (Walker->nr < OtherAtom->nr)) {
+    molecule::iterator Walker = (*MolWalker)->begin();
+    for(;Walker!=(*MolWalker)->end();++Walker){
+      atom * theAtom = *Walker;
+      if ((theAtom->type == first) || (theAtom->type == second)) {  // first element matches
+        for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) {
+          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
+          if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (theAtom->nr < OtherAtom->nr)) {
             count++;
             DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl);
@@ -240,5 +231,4 @@
   bool MatchFlag[2];
   bool result = false;
-  atom *Walker = NULL;
   const element * ElementArray[2];
   ElementArray[0] = first;
@@ -246,12 +236,12 @@
 
   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) {
-    Walker = (*MolWalker)->start;
-    while (Walker->next != (*MolWalker)->end) {
-      Walker = Walker->next;
-      if (Walker->type == second) {  // first element matches
+    molecule::iterator Walker = (*MolWalker)->begin();
+    for(;Walker!=(*MolWalker)->end();++Walker){
+      atom *theAtom = *Walker;
+      if (theAtom->type == second) {  // first element matches
         for (int i=0;i<2;i++)
           MatchFlag[i] = false;
-        for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {
-          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Walker);
+        for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) {
+          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
           for (int i=0;i<2;i++)
             if ((!MatchFlag[i]) && (OtherAtom->type == ElementArray[i])) {
Index: src/analysis_correlation.cpp
===================================================================
--- src/analysis_correlation.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/analysis_correlation.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -39,32 +39,33 @@
     return outmap;
   }
+  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
+    (*MolWalker)->doCountAtoms();
   outmap = new PairCorrelationMap;
-  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
+  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){
     if ((*MolWalker)->ActiveFlag) {
       DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
-      atom *Walker = (*MolWalker)->start;
-      while (Walker->next != (*MolWalker)->end) {
-        Walker = Walker->next;
-        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl);
-        if ((type1 == NULL) || (Walker->type == type1)) {
-          for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++)
+      eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
+      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
+        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
+        if ((type1 == NULL) || ((*iter)->type == type1)) {
+          for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){
             if ((*MolOtherWalker)->ActiveFlag) {
               DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
-              atom *OtherWalker = (*MolOtherWalker)->start;
-              while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker
-                OtherWalker = OtherWalker->next;
-                DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl);
-                if (Walker->nr < OtherWalker->nr)
-                  if ((type2 == NULL) || (OtherWalker->type == type2)) {
-                    distance = Walker->node->PeriodicDistance(*OtherWalker->node, World::getInstance().getDomain());
-                    //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
-                    outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) );
+              for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
+                DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
+                if ((*iter)->getId() < (*runner)->getId()){
+                  if ((type2 == NULL) || ((*runner)->type == type2)) {
+                    distance = (*iter)->node->PeriodicDistance(*(*runner)->node,  World::getInstance().getDomain());
+                    //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
+                    outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
                   }
+                }
               }
+            }
           }
         }
       }
     }
-
+  }
   return outmap;
 };
@@ -95,4 +96,6 @@
     return outmap;
   }
+  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
+    (*MolWalker)->doCountAtoms();
   outmap = new PairCorrelationMap;
   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
@@ -101,10 +104,8 @@
       double * FullInverseMatrix = InverseMatrix(FullMatrix);
       DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
-      atom *Walker = (*MolWalker)->start;
-      while (Walker->next != (*MolWalker)->end) {
-        Walker = Walker->next;
-        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl);
-        if ((type1 == NULL) || (Walker->type == type1)) {
-          periodicX = *(Walker->node);
+      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
+        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
+        if ((type1 == NULL) || ((*iter)->type == type1)) {
+          periodicX = *(*iter)->node;
           periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
           // go through every range in xyz and get distance
@@ -117,11 +118,9 @@
                   if ((*MolOtherWalker)->ActiveFlag) {
                     DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);
-                    atom *OtherWalker = (*MolOtherWalker)->start;
-                    while (OtherWalker->next != (*MolOtherWalker)->end) { // only go up to Walker
-                      OtherWalker = OtherWalker->next;
-                      DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << *OtherWalker << "." << endl);
-                      if (Walker->nr < OtherWalker->nr)
-                        if ((type2 == NULL) || (OtherWalker->type == type2)) {
-                          periodicOtherX = *(OtherWalker->node);
+                    for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {
+                      DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
+                      if ((*iter)->nr < (*runner)->nr)
+                        if ((type2 == NULL) || ((*runner)->type == type2)) {
+                          periodicOtherX = *(*runner)->node;
                           periodicOtherX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
                           // go through every range in xyz and get distance
@@ -132,6 +131,6 @@
                                 checkOtherX.MatrixMultiplication(FullMatrix);
                                 distance = checkX.distance(checkOtherX);
-                                //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
-                                outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) );
+                                //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
+                                outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
                               }
                         }
@@ -141,6 +140,6 @@
         }
       }
-      Free(&FullMatrix);
-      Free(&FullInverseMatrix);
+      delete[](FullMatrix);
+      delete[](FullInverseMatrix);
     }
 
@@ -165,16 +164,16 @@
     return outmap;
   }
+  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
+    (*MolWalker)->doCountAtoms();
   outmap = new CorrelationToPointMap;
   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
     if ((*MolWalker)->ActiveFlag) {
       DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
-      atom *Walker = (*MolWalker)->start;
-      while (Walker->next != (*MolWalker)->end) {
-        Walker = Walker->next;
-        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl);
-        if ((type == NULL) || (Walker->type == type)) {
-          distance = Walker->node->PeriodicDistance(*point, World::getInstance().getDomain());
+      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
+        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
+        if ((type == NULL) || ((*iter)->type == type)) {
+          distance = (*iter)->node->PeriodicDistance(*point, World::getInstance().getDomain());
           DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
-          outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
+          outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
         }
       }
@@ -205,4 +204,6 @@
     return outmap;
   }
+  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
+    (*MolWalker)->doCountAtoms();
   outmap = new CorrelationToPointMap;
   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
@@ -211,10 +212,8 @@
       double * FullInverseMatrix = InverseMatrix(FullMatrix);
       DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
-      atom *Walker = (*MolWalker)->start;
-      while (Walker->next != (*MolWalker)->end) {
-        Walker = Walker->next;
-        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl);
-        if ((type == NULL) || (Walker->type == type)) {
-          periodicX = *(Walker->node);
+      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
+        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
+        if ((type == NULL) || ((*iter)->type == type)) {
+          periodicX = *(*iter)->node;
           periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
           // go through every range in xyz and get distance
@@ -226,10 +225,10 @@
                 distance = checkX.distance(*point);
                 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
-                outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
+                outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) );
               }
         }
       }
-      Free(&FullMatrix);
-      Free(&FullInverseMatrix);
+      delete[](FullMatrix);
+      delete[](FullInverseMatrix);
     }
 
@@ -257,21 +256,24 @@
     return outmap;
   }
+  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
+    (*MolWalker)->doCountAtoms();
   outmap = new CorrelationToSurfaceMap;
   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
     if ((*MolWalker)->ActiveFlag) {
       DoLog(1) && (Log() << Verbose(1) << "Current molecule is " << (*MolWalker)->name << "." << endl);
-      atom *Walker = (*MolWalker)->start;
-      while (Walker->next != (*MolWalker)->end) {
-        Walker = Walker->next;
-        //Log() << Verbose(1) << "Current atom is " << *Walker << "." << endl;
-        if ((type == NULL) || (Walker->type == type)) {
-          TriangleIntersectionList Intersections(Walker->node,Surface,LC);
+      if ((*MolWalker)->empty())
+        DoLog(1) && (1) && (Log() << Verbose(1) << "\t is empty." << endl);
+      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
+        DoLog(1) && (Log() << Verbose(1) << "\tCurrent atom is " << *(*iter) << "." << endl);
+        if ((type == NULL) || ((*iter)->type == type)) {
+          TriangleIntersectionList Intersections((*iter)->node,Surface,LC);
           distance = Intersections.GetSmallestDistance();
           triangle = Intersections.GetClosestTriangle();
-          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) );
-        }
-      }
-    } else
+          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) );
+        }
+      }
+    } else {
       DoLog(1) && (Log() << Verbose(1) << "molecule " << (*MolWalker)->name << " is not active." << endl);
+    }
 
   return outmap;
@@ -306,4 +308,6 @@
     return outmap;
   }
+  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
+    (*MolWalker)->doCountAtoms();
   outmap = new CorrelationToSurfaceMap;
   double ShortestDistance = 0.;
@@ -314,10 +318,8 @@
       double * FullInverseMatrix = InverseMatrix(FullMatrix);
       DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
-      atom *Walker = (*MolWalker)->start;
-      while (Walker->next != (*MolWalker)->end) {
-        Walker = Walker->next;
-        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl);
-        if ((type == NULL) || (Walker->type == type)) {
-          periodicX = *(Walker->node);
+      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
+        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
+        if ((type == NULL) || ((*iter)->type == type)) {
+          periodicX = *(*iter)->node;
           periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
           // go through every range in xyz and get distance
@@ -337,10 +339,10 @@
               }
           // insert
-          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (Walker, ShortestTriangle) ) );
+          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) );
           //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl;
         }
       }
-      Free(&FullMatrix);
-      Free(&FullInverseMatrix);
+      delete[](FullMatrix);
+      delete[](FullInverseMatrix);
     }
 
Index: src/analyzer.cpp
===================================================================
--- src/analyzer.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/analyzer.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -75,5 +75,5 @@
     return 1;
   } else {
-    dir = Malloc<char>(strlen(argv[2]) + 2, "main: *dir");
+    dir = new char[strlen(argv[2]) + 2];
     strcpy(dir, "/");
     strcat(dir, argv[2]);
@@ -82,5 +82,5 @@
   if (argc > 4) {
     DoLog(0) && (Log() << Verbose(0) << "Loading periodentafel." << endl);
-    periode = Malloc<periodentafel>(1, "main - periode");
+    periode = new periodentafel;
     periode->LoadPeriodentafel(argv[4]);
   }
@@ -558,5 +558,5 @@
   // ++++++++++++++++ exit ++++++++++++++++++++++++++++++++++
   delete(periode);
-  Free(&dir);
+  delete[](dir);
   DoLog(0) && (Log() << Verbose(0) << "done." << endl);
   return 0;
Index: src/atom.cpp
===================================================================
--- src/atom.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/atom.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -40,5 +40,5 @@
 
 atom *atom::clone(){
-  atom *res = new atom();
+  atom *res = new atom(this);
   res->previous=0;
   res->next=0;
@@ -59,5 +59,4 @@
 atom::~atom()
 {
-  unlink(this);
 };
 
@@ -270,6 +269,6 @@
 {
   if (ComponentNr != NULL)
-    Free(&ComponentNr);
-  ComponentNr = Malloc<int>(ListOfBonds.size()+1, "atom::InitComponentNumbers: *ComponentNr");
+    delete[](ComponentNr);
+  ComponentNr = new int[ListOfBonds.size()+1];
   for (int i=ListOfBonds.size()+1;i--;)
     ComponentNr[i] = -1;
Index: src/atom_bondedparticle.cpp
===================================================================
--- src/atom_bondedparticle.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/atom_bondedparticle.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -44,5 +44,5 @@
 void BondedParticle::OutputBondOfAtom() const
 {
-  DoLog(4) && (Log() << Verbose(4) << "Atom " << Name << "/" << nr << " with " << ListOfBonds.size() << " bonds: " << endl);
+  DoLog(4) && (Log() << Verbose(4) << "Atom " << getName() << "/" << nr << " with " << ListOfBonds.size() << " bonds: " << endl);
   int TotalDegree = 0;
   for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); ++Runner) {
Index: src/atom_graphnode.cpp
===================================================================
--- src/atom_graphnode.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/atom_graphnode.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -27,5 +27,5 @@
 void GraphNode::OutputGraphInfo() const
 {
-  DoLog(2) && (Log() << Verbose(2) << "Atom " << Name << " is " << ((SeparationVertex) ? "a" : "not a") << " separation vertex, components are ");
+  DoLog(2) && (Log() << Verbose(2) << "Atom " << getName() << " is " << ((SeparationVertex) ? "a" : "not a") << " separation vertex, components are ");
   OutputComponentNumber();
   DoLog(3) && (Log() << Verbose(3) << " with Lowpoint " << LowpointNr << " and Graph Nr. " << GraphNr << "." << endl);
Index: src/atom_graphnodeinfo.cpp
===================================================================
--- src/atom_graphnodeinfo.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/atom_graphnodeinfo.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -17,4 +17,4 @@
 GraphNodeInfo::~GraphNodeInfo()
 {
-  Free<int>(&ComponentNr, "atom::~atom: *ComponentNr");
+  delete[](ComponentNr);
 };
Index: src/atom_particleinfo.cpp
===================================================================
--- src/atom_particleinfo.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/atom_particleinfo.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -11,13 +11,11 @@
 /** Constructor of ParticleInfo.
  */
-ParticleInfo::ParticleInfo() : nr(-1), Name(NULL) {};
+ParticleInfo::ParticleInfo() : nr(-1), name("Unknown") {
+};
 
 ParticleInfo::ParticleInfo(ParticleInfo *pointer) :
     nr(pointer->nr),
-    Name(pointer->Name)
-    {
-      if (Name == NULL)
-        Name = " ";
-    }
+    name(pointer->name)
+    {}
 
 
@@ -25,14 +23,17 @@
  */
 ParticleInfo::~ParticleInfo()
-{
-  Free(&Name);
-};
+{};
+
+const string& ParticleInfo::getName() const{
+  return name;
+}
+
+void ParticleInfo::setName(const string& _name){
+  name = _name;
+}
 
 ostream & operator << (ostream &ost, const ParticleInfo &a)
 {
-  if (a.Name == NULL)
-    ost << "[NULL]";
-  else
-    ost << "[" << a.Name << "|" << &a << "]";
+  ost << "[" << a.getName() << "|" << &a << "]";
   return ost;
 };
@@ -40,8 +41,5 @@
 ostream & ParticleInfo::operator << (ostream &ost) const
 {
-  if (Name == NULL)
-    ost << "[NULL]";
-  else
-    ost << "[" << Name << "|" << this << "]";
+  ost << "[" << name << "|" << this << "]";
   return ost;
 };
Index: src/atom_particleinfo.hpp
===================================================================
--- src/atom_particleinfo.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/atom_particleinfo.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -28,5 +28,4 @@
 public:
   int nr;       // index to easierly identify
-  char *Name;   // some name to reference to on output
 
   ParticleInfo();
@@ -34,7 +33,11 @@
   ~ParticleInfo();
 
+  const std::string& getName() const;
+  void setName(const std::string&);
+
   ostream & operator << (ostream &ost) const;
 
 private:
+  std::string name;   // some name to reference to on output
 };
 
Index: src/atom_trajectoryparticle.cpp
===================================================================
--- src/atom_trajectoryparticle.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/atom_trajectoryparticle.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -10,4 +10,5 @@
 #include "config.hpp"
 #include "element.hpp"
+#include "info.hpp"
 #include "log.hpp"
 #include "parser.hpp"
@@ -71,6 +72,7 @@
 void TrajectoryParticle::ResizeTrajectory(int MaxSteps)
 {
+  Info FunctionInfo(__func__);
   if (Trajectory.R.size() <= (unsigned int)(MaxSteps)) {
-    //Log() << Verbose(0) << "Increasing size for trajectory array of " << keyword << " to " << (MaxSteps+1) << "." << endl;
+    DoLog(0) && (Log() << Verbose(0) << "Increasing size for trajectory array of " << nr << " from " << Trajectory.R.size() << " to " << (MaxSteps+1) << "." << endl);
     Trajectory.R.resize(MaxSteps+1);
     Trajectory.U.resize(MaxSteps+1);
Index: src/bond.cpp
===================================================================
--- src/bond.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/bond.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -53,5 +53,5 @@
 ostream & operator << (ostream &ost, const bond &b)
 {
-  ost << "[" << b.leftatom->Name << " <" << b.BondDegree << "(H" << b.HydrogenBond << ")>" << b.rightatom->Name << "]";
+  ost << "[" << b.leftatom->getName() << " <" << b.BondDegree << "(H" << b.HydrogenBond << ")>" << b.rightatom->getName() << "]";
   return ost;
 };
Index: src/bondgraph.cpp
===================================================================
--- src/bondgraph.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/bondgraph.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -88,7 +88,7 @@
 {
   Info FunctionInfo(__func__);
-bool status = true;
+  bool status = true;
 
-  if (mol->start->next == mol->end) // only construct if molecule is not empty
+  if (mol->empty()) // only construct if molecule is not empty
     return false;
 
@@ -124,9 +124,7 @@
   max_distance = 0.;
 
-  atom *Runner = mol->start;
-  while (Runner->next != mol->end) {
-    Runner = Runner->next;
-    if (Runner->type->CovalentRadius > max_distance)
-      max_distance = Runner->type->CovalentRadius;
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    if ((*iter)->type->CovalentRadius > max_distance)
+      max_distance = (*iter)->type->CovalentRadius;
   }
   max_distance *= 2.;
Index: src/boundary.cpp
===================================================================
--- src/boundary.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/boundary.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -139,5 +139,4 @@
 {
 	Info FunctionInfo(__func__);
-  atom *Walker = NULL;
   PointMap PointsOnBoundary;
   LineMap LinesOnBoundary;
@@ -165,8 +164,6 @@
 
     // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours
-    Walker = mol->start;
-    while (Walker->next != mol->end) {
-      Walker = Walker->next;
-      ProjectedVector = Walker->x - (*MolCenter);
+    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+      ProjectedVector = (*iter)->x - (*MolCenter);
       ProjectedVector.ProjectOntoPlane(AxisVector);
 
@@ -182,21 +179,22 @@
         angle = 2. * M_PI - angle;
       }
-      DoLog(1) && (Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl);
-      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker)));
+    DoLog(1) && (Log() << Verbose(1) << "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl);
+      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, (*iter))));
       if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity
         DoLog(2) && (Log() << Verbose(2) << "Encountered two vectors whose projection onto axis " << axis << " is equal: " << endl);
         DoLog(2) && (Log() << Verbose(2) << "Present vector: " << *BoundaryTestPair.first->second.second << endl);
-        DoLog(2) && (Log() << Verbose(2) << "New vector: " << *Walker << endl);
+        DoLog(2) && (Log() << Verbose(2) << "New vector: " << **iter << endl);
         const double ProjectedVectorNorm = ProjectedVector.NormSquared();
         if ((ProjectedVectorNorm - BoundaryTestPair.first->second.first) > MYEPSILON) {
           BoundaryTestPair.first->second.first = ProjectedVectorNorm;
-          BoundaryTestPair.first->second.second = Walker;
+          BoundaryTestPair.first->second.second = (*iter);
           DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);
         } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) {
-          helper = Walker->x - (*MolCenter);
+          helper = (*iter)->x;
+          helper -= *MolCenter;
           const double oldhelperNorm = helper.NormSquared();
           helper = BoundaryTestPair.first->second.second->x - (*MolCenter);
           if (helper.NormSquared() < oldhelperNorm) {
-            BoundaryTestPair.first->second.second = Walker;
+            BoundaryTestPair.first->second.second = (*iter);
             DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "." << endl);
           } else {
@@ -226,7 +224,11 @@
     do { // do as long as we still throw one out per round
       flag = false;
-      Boundaries::iterator left = BoundaryPoints[axis].end();
-      Boundaries::iterator right = BoundaryPoints[axis].end();
-      for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
+      Boundaries::iterator left = BoundaryPoints[axis].begin();
+      Boundaries::iterator right = BoundaryPoints[axis].begin();
+      Boundaries::iterator runner = BoundaryPoints[axis].begin();
+      bool LoopOnceDone = false;
+      while (!LoopOnceDone) {
+	runner = right;
+	right++;
         // set neighbours correctly
         if (runner == BoundaryPoints[axis].begin()) {
@@ -236,8 +238,7 @@
         }
         left--;
-        right = runner;
-        right++;
         if (right == BoundaryPoints[axis].end()) {
           right = BoundaryPoints[axis].begin();
+          LoopOnceDone = true;
         }
         // check distance
@@ -279,4 +280,5 @@
             DoLog(1) && (Log() << Verbose(1) << "Throwing out " << *runner->second.second << "." << endl);
             BoundaryPoints[axis].erase(runner);
+            runner = right;
             flag = true;
           }
@@ -359,24 +361,5 @@
 
   // 4. Store triangles in tecplot file
-  if (filename != NULL) {
-    if (DoTecplotOutput) {
-      string OutputName(filename);
-      OutputName.append("_intermed");
-      OutputName.append(TecplotSuffix);
-      ofstream *tecplot = new ofstream(OutputName.c_str());
-      WriteTecplotFile(tecplot, TesselStruct, mol, 0);
-      tecplot->close();
-      delete(tecplot);
-    }
-    if (DoRaster3DOutput) {
-      string OutputName(filename);
-      OutputName.append("_intermed");
-      OutputName.append(Raster3DSuffix);
-      ofstream *rasterplot = new ofstream(OutputName.c_str());
-      WriteRaster3dFile(rasterplot, TesselStruct, mol);
-      rasterplot->close();
-      delete(rasterplot);
-    }
-  }
+  StoreTrianglesinFile(mol, TesselStruct, filename, "_intermed");
 
   // 3d. check all baselines whether the peaks of the two adjacent triangles with respect to center of baseline are convex, if not, make the baseline between the two peaks and baseline endpoints become the new peaks
@@ -397,4 +380,5 @@
           TesselStruct->FlipBaseline(line);
           DoLog(1) && (Log() << Verbose(1) << "INFO: Correction of concave baselines worked." << endl);
+          LineRunner = TesselStruct->LinesOnBoundary.begin(); // LineRunner may have been erase if line was deleted from LinesOnBoundary
         }
       }
@@ -409,23 +393,5 @@
 
   // 4. Store triangles in tecplot file
-  if (filename != NULL) {
-    if (DoTecplotOutput) {
-      string OutputName(filename);
-      OutputName.append(TecplotSuffix);
-      ofstream *tecplot = new ofstream(OutputName.c_str());
-      WriteTecplotFile(tecplot, TesselStruct, mol, 0);
-      tecplot->close();
-      delete(tecplot);
-    }
-    if (DoRaster3DOutput) {
-      string OutputName(filename);
-      OutputName.append(Raster3DSuffix);
-      ofstream *rasterplot = new ofstream(OutputName.c_str());
-      WriteRaster3dFile(rasterplot, TesselStruct, mol);
-      rasterplot->close();
-      delete(rasterplot);
-    }
-  }
-
+  StoreTrianglesinFile(mol, TesselStruct, filename, "");
 
   // free reference lists
@@ -620,14 +586,12 @@
   for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++)
     { // go through every triangle, calculate volume of its pyramid with CoG as peak
-      x = (*runner->second->endpoints[0]->node->node) - (*runner->second->endpoints[1]->node->node);
-      y = (*runner->second->endpoints[0]->node->node) - (*runner->second->endpoints[2]->node->node);
-      const double a = sqrt(runner->second->endpoints[0]->node->node->DistanceSquared(*runner->second->endpoints[1]->node->node));
-      const double b = sqrt(runner->second->endpoints[0]->node->node->DistanceSquared(*runner->second->endpoints[2]->node->node));
-      const double c = sqrt(runner->second->endpoints[2]->node->node->DistanceSquared(*runner->second->endpoints[1]->node->node));
+      x = runner->second->getEndpoint(0) - runner->second->getEndpoint(1);
+      y = runner->second->getEndpoint(0) - runner->second->getEndpoint(2);
+      const double a = x.Norm();
+      const double b = y.Norm();
+      const double c = runner->second->getEndpoint(2).distance(runner->second->getEndpoint(1));
       const double G = sqrt(((a + b + c) * (a + b + c) - 2 * (a * a + b * b + c * c)) / 16.); // area of tesselated triangle
-      x = Plane(*(runner->second->endpoints[0]->node->node),
-                *(runner->second->endpoints[1]->node->node),
-                *(runner->second->endpoints[2]->node->node)).getNormal();
-      x.Scale(runner->second->endpoints[1]->node->node->ScalarProduct(x));
+      x = runner->second->getPlane().getNormal();
+      x.Scale(runner->second->getEndpoint(1).ScalarProduct(x));
       const double h = x.Norm(); // distance of CoG to triangle
       const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak)
@@ -680,4 +644,5 @@
 /** Creates multiples of the by \a *mol given cluster and suspends them in water with a given final density.
  * We get cluster volume by VolumeOfConvexEnvelope() and its diameters by GetDiametersOfCluster()
+ * TODO: Here, we need a VolumeOfGeneralEnvelope (i.e. non-convex one)
  * \param *out output stream for debugging
  * \param *configuration needed for path to store convex envelope file
@@ -697,5 +662,4 @@
   int repetition[NDIM] = { 1, 1, 1 };
   int TotalNoClusters = 1;
-  atom *Walker = NULL;
   double totalmass = 0.;
   double clustervolume = 0.;
@@ -708,6 +672,8 @@
   GreatestDiameter = GetDiametersOfCluster(BoundaryPoints, mol, TesselStruct, IsAngstroem);
   BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
-  LinkedCell LCList(mol, 10.);
-  FindConvexBorder(mol, TesselStruct, &LCList, NULL);
+  LinkedCell *LCList = new LinkedCell(mol, 10.);
+  FindConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, NULL);
+  delete (LCList);
+
 
   // some preparations beforehand
@@ -721,8 +687,6 @@
 
   // sum up the atomic masses
-  Walker = mol->start;
-  while (Walker->next != mol->end) {
-      Walker = Walker->next;
-      totalmass += Walker->type->mass;
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+      totalmass += (*iter)->type->mass;
   }
   DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);
@@ -806,5 +770,4 @@
   Vector Inserter;
   double FillIt = false;
-  atom *Walker = NULL;
   bond *Binder = NULL;
   double phi[NDIM];
@@ -813,5 +776,5 @@
 
   for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++)
-    if ((*ListRunner)->AtomCount > 0) {
+    if ((*ListRunner)->getAtomCount() > 0) {
       DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl);
       LCList[(*ListRunner)] = new LinkedCell((*ListRunner), 10.); // get linked cell list
@@ -824,13 +787,12 @@
   filler->CenterEdge(&Inserter);
   filler->Center.Zero();
+  const int FillerCount = filler->getAtomCount();
   DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl);
-  Binder = filler->first;
-  while(Binder->next != filler->last) {
-    Binder = Binder->next;
-    DoLog(2) && (Log() << Verbose(2) << "  " << *Binder << endl);
-  }
-
-  filler->CountAtoms();
-  atom * CopyAtoms[filler->AtomCount];
+  for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner)
+    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
+      if ((*BondRunner)->leftatom == *AtomRunner)
+        DoLog(2) && (Log() << Verbose(2) << "  " << *(*BondRunner) << endl);
+
+  atom * CopyAtoms[FillerCount];
 
   // calculate filler grid in [0,1]^3
@@ -857,9 +819,7 @@
 
         // go through all atoms
-        for (int i=0;i<filler->AtomCount;i++)
+        for (int i=0;i<FillerCount;i++)
           CopyAtoms[i] = NULL;
-        Walker = filler->start;
-        while (Walker->next != filler->end) {
-          Walker = Walker->next;
+        for(molecule::const_iterator iter = filler->begin(); iter !=filler->end();++iter){
 
           // create atomic random translation vector ...
@@ -885,5 +845,5 @@
 
           // ... and put at new position
-          Inserter = Walker->x;
+          Inserter = (*iter)->x;
           if (DoRandomRotation)
             Inserter.MatrixMultiplication(Rotations);
@@ -909,26 +869,27 @@
             DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is outer point." << endl);
             // copy atom ...
-            CopyAtoms[Walker->nr] = Walker->clone();
-            CopyAtoms[Walker->nr]->x = Inserter;
-            Filling->AddAtom(CopyAtoms[Walker->nr]);
-            DoLog(4) && (Log() << Verbose(4) << "Filling atom " << *Walker << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[Walker->nr]->x) << "." << endl);
+            CopyAtoms[(*iter)->nr] = (*iter)->clone();
+            CopyAtoms[(*iter)->nr]->x = Inserter;
+            Filling->AddAtom(CopyAtoms[(*iter)->nr]);
+            DoLog(4) && (Log() << Verbose(4) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->x) << "." << endl);
           } else {
             DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);
-            CopyAtoms[Walker->nr] = NULL;
+            CopyAtoms[(*iter)->nr] = NULL;
             continue;
           }
         }
         // go through all bonds and add as well
-        Binder = filler->first;
-        while(Binder->next != filler->last) {
-          Binder = Binder->next;
-          if ((CopyAtoms[Binder->leftatom->nr] != NULL) && (CopyAtoms[Binder->rightatom->nr] != NULL)) {
-            Log()  << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->nr] << " and " << *CopyAtoms[Binder->rightatom->nr]<< "." << endl;
-            Filling->AddBond(CopyAtoms[Binder->leftatom->nr], CopyAtoms[Binder->rightatom->nr], Binder->BondDegree);
-          }
-        }
+        for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner)
+          for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
+            if ((*BondRunner)->leftatom == *AtomRunner) {
+              Binder = (*BondRunner);
+              if ((CopyAtoms[Binder->leftatom->nr] != NULL) && (CopyAtoms[Binder->rightatom->nr] != NULL)) {
+                Log()  << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->nr] << " and " << *CopyAtoms[Binder->rightatom->nr]<< "." << endl;
+                Filling->AddBond(CopyAtoms[Binder->leftatom->nr], CopyAtoms[Binder->rightatom->nr], Binder->BondDegree);
+              }
+            }
       }
-  Free(&M);
-  Free(&MInverse);
+  delete[](M);
+  delete[](MInverse);
 
   return Filling;
@@ -954,4 +915,6 @@
   bool TesselationFailFlag = false;
 
+  mol->getAtomCount();
+
   if (TesselStruct == NULL) {
     DoLog(1) && (Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl);
@@ -1025,8 +988,7 @@
 //  // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
 //  //->InsertStraddlingPoints(mol, LCList);
-//  mol->GoToFirst();
+//  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
 //  class TesselPoint *Runner = NULL;
-//  while (!mol->IsEnd()) {
-//    Runner = mol->GetPoint();
+//    Runner = *iter;
 //    Log() << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl;
 //    if (!->IsInnerPoint(Runner, LCList)) {
@@ -1036,5 +998,4 @@
 //      Log() << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl;
 //    }
-//    mol->GoToNext();
 //  }
 
@@ -1045,6 +1006,8 @@
   status = CheckListOfBaselines(TesselStruct);
 
+  cout << "before correction" << endl;
+
   // store before correction
-  StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, "");
+  StoreTrianglesinFile(mol, TesselStruct, filename, "");
 
 //  // correct degenerated polygons
@@ -1056,5 +1019,6 @@
   // write final envelope
   CalculateConcavityPerBoundaryPoint(TesselStruct);
-  StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, "");
+  cout << "after correction" << endl;
+  StoreTrianglesinFile(mol, TesselStruct, filename, "");
 
   if (freeLC)
Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/builder.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -53,4 +53,5 @@
 
 #include <cstring>
+#include <cstdlib>
 
 #include "analysis_bonds.hpp"
@@ -864,6 +865,6 @@
 
         mol->CountAtoms(); // recount atoms
-        if (mol->AtomCount != 0) {  // if there is more than none
-          count = mol->AtomCount;  // is changed becausing of adding, thus has to be stored away beforehand
+        if (mol->getAtomCount() != 0) {  // if there is more than none
+          count = mol->getAtomCount();  // is changed becausing of adding, thus has to be stored away beforehand
           Elements = new element *[count];
           vectors = new Vector *[count];
@@ -1295,5 +1296,5 @@
   // generate some KeySets
   DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl);
-  KeySet TestSets[mol->AtomCount+1];
+  KeySet TestSets[mol->getAtomCount()+1];
   i=1;
   while (Walker->next != mol->end) {
@@ -1306,5 +1307,5 @@
   DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl);
   KeySetTestPair test;
-  test = TestSets[mol->AtomCount-1].insert(Walker->nr);
+  test = TestSets[mol->getAtomCount()-1].insert(Walker->nr);
   if (test.second) {
     DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
@@ -1312,6 +1313,6 @@
     DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl);
   }
-  TestSets[mol->AtomCount].insert(mol->end->previous->nr);
-  TestSets[mol->AtomCount].insert(mol->end->previous->previous->previous->nr);
+  TestSets[mol->getAtomCount()].insert(mol->end->previous->nr);
+  TestSets[mol->getAtomCount()].insert(mol->end->previous->previous->previous->nr);
 
   // constructing Graph structure
@@ -1321,10 +1322,10 @@
   // insert KeySets into Subgraphs
   DoLog(0) && (Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl);
-  for (int j=0;j<mol->AtomCount;j++) {
+  for (int j=0;j<mol->getAtomCount();j++) {
     Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
   }
   DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl);
   GraphTestPair test2;
-  test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.)));
+  test2 = Subgraphs.insert(GraphPair (TestSets[mol->getAtomCount()],pair<int, double>(counter++, 1.)));
   if (test2.second) {
     DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
@@ -1494,5 +1495,5 @@
  */
 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode,
-                                   config& configuration, char *&ConfigFileName, set<int> &ArgcList)
+                                   config& configuration, char **ConfigFileName, set<int> &ArgcList)
 {
   Vector x,y,z,n;  // coordinates for absolute point in cell volume
@@ -1512,5 +1513,5 @@
   molecule *mol = NULL;
   string BondGraphFileName("\n");
-  strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1);
+  bool DatabasePathGiven = false;
 
   if (argc > 1) { // config file specified as option
@@ -1529,28 +1530,23 @@
             break;
           case 'v':
-            ArgcList.insert(argptr-1);
-            return(1);
-            break;
-          case 'V':
+            setVerbosity(atoi(argv[argptr]));
             ArgcList.insert(argptr-1);
             ArgcList.insert(argptr);
             argptr++;
             break;
+          case 'V':
+            ArgcList.insert(argptr-1);
+            return(1);
+            break;
           case 'B':
+            ArgcList.insert(argptr-1);
+            ArgcList.insert(argptr);
+            ArgcList.insert(argptr+1);
+            ArgcList.insert(argptr+2);
+            ArgcList.insert(argptr+3);
+            ArgcList.insert(argptr+4);
+            ArgcList.insert(argptr+5);
+            argptr+=6;
             if (ExitFlag == 0) ExitFlag = 1;
-            if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) {
-              ExitFlag = 255;
-              DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl);
-              performCriticalExit();
-            } else {
-              SaveFlag = true;
-              j = -1;
-              DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl);
-              double * const cell_size = World::getInstance().getDomain();
-              for (int i=0;i<6;i++) {
-                cell_size[i] = atof(argv[argptr+i]);
-              }
-              argptr+=6;
-            }
             break;
           case 'e':
@@ -1561,4 +1557,5 @@
               DoLog(0) && (Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl);
               strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1);
+              DatabasePathGiven = true;
               argptr+=1;
             }
@@ -1574,4 +1571,15 @@
             }
             break;
+          case 'M':
+            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
+              ExitFlag = 255;
+              DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -M <basis name>" << endl);
+              performCriticalExit();
+            } else {
+              configuration.basis = argv[argptr];
+              DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl);
+              argptr+=1;
+            }
+            break;
           case 'n':
             DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
@@ -1581,5 +1589,5 @@
             {
               World::getInstance().setDefaultName(argv[argptr]);
-              DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << *World::getInstance().getDefaultName() << "." << endl);
+              DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << World::getInstance().getDefaultName() << "." << endl);
             }
             break;
@@ -1593,11 +1601,12 @@
 
     // 3a. Parse the element database
-    if (periode->LoadPeriodentafel(configuration.databasepath)) {
-      DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
-      //periode->Output();
-    } else {
-      DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
-      return 1;
-    }
+    if (DatabasePathGiven)
+      if (periode->LoadPeriodentafel(configuration.databasepath)) {
+        DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
+        //periode->Output();
+      } else {
+        DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
+        return 1;
+      }
     // 3b. Find config file name and parse if possible, also BondGraphFileName
     if (argv[1][0] != '-') {
@@ -1613,5 +1622,5 @@
         } else {
           DoLog(0) && (Log() << Verbose(0) << "Empty configuration file." << endl);
-          ConfigFileName = argv[1];
+          strcpy(*ConfigFileName, argv[1]);
           configPresent = empty;
           output.close();
@@ -1619,15 +1628,15 @@
       } else {
         test.close();
-        ConfigFileName = argv[1];
+        strcpy(*ConfigFileName, argv[1]);
         DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... ");
-        switch (configuration.TestSyntax(ConfigFileName, periode)) {
+        switch (configuration.TestSyntax(*ConfigFileName, periode)) {
           case 1:
             DoLog(0) && (Log() << Verbose(0) << "new syntax." << endl);
-            configuration.Load(ConfigFileName, BondGraphFileName, periode, molecules);
+            configuration.Load(*ConfigFileName, BondGraphFileName, periode, molecules);
             configPresent = present;
             break;
           case 0:
             DoLog(0) && (Log() << Verbose(0) << "old syntax." << endl);
-            configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, molecules);
+            configuration.LoadOld(*ConfigFileName, BondGraphFileName, periode, molecules);
             configPresent = present;
             break;
@@ -1650,6 +1659,6 @@
        mol = World::getInstance().createMolecule();
        mol->ActiveFlag = true;
-       if (ConfigFileName != NULL)
-         mol->SetNameFromFilename(ConfigFileName);
+       if (*ConfigFileName != NULL)
+         mol->SetNameFromFilename(*ConfigFileName);
        molecules->insert(mol);
      }
@@ -1705,5 +1714,5 @@
                 if (first->type != NULL) {
                   mol->AddAtom(first);  // add to molecule
-                  if ((configPresent == empty) && (mol->AtomCount != 0))
+                  if ((configPresent == empty) && (mol->getAtomCount() != 0))
                     configPresent = present;
                 } else
@@ -1718,15 +1727,4 @@
         if (configPresent == present) {
           switch(argv[argptr-1][1]) {
-            case 'M':
-              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
-                ExitFlag = 255;
-                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl);
-                performCriticalExit();
-              } else {
-                configuration.basis = argv[argptr];
-                DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl);
-                argptr+=1;
-              }
-              break;
             case 'D':
               if (ExitFlag == 0) ExitFlag = 1;
@@ -1734,5 +1732,5 @@
                 DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl);
                 MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
-                int *MinimumRingSize = new int[mol->AtomCount];
+                int *MinimumRingSize = new int[mol->getAtomCount()];
                 atom ***ListOfLocalAtoms = NULL;
                 class StackClass<bond *> *BackEdgeStack = NULL;
@@ -1754,6 +1752,6 @@
                   delete(Subgraphs);
                   for (int i=0;i<FragmentCounter;i++)
-                    Free(&ListOfLocalAtoms[i]);
-                  Free(&ListOfLocalAtoms);
+                    delete[](ListOfLocalAtoms[i]);
+                  delete[](ListOfLocalAtoms);
                 }
                 delete(BackEdgeStack);
@@ -1795,5 +1793,5 @@
                         if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (!IsValidNumber(argv[argptr+2])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-')) {
                           ExitFlag = 255;
-                          DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C E <Z1> <Z2> <output> <bin output>" << endl);
+                          DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C E <Z1> <Z2> <output> <bin output> <binstart> <binend>" << endl);
                           performCriticalExit();
                         } else {
@@ -1810,5 +1808,5 @@
                           else
                             correlationmap = PairCorrelation(molecules, elemental, elemental2);
-                          //OutputCorrelationToSurface(&output, correlationmap);
+                          OutputPairCorrelation(&output, correlationmap);
                           BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd );
                           OutputCorrelation ( &binoutput, binmap );
@@ -1826,5 +1824,5 @@
                         if ((argptr+8 >= argc) || (!IsValidNumber(argv[argptr+1])) ||  (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+7])) || (!IsValidNumber(argv[argptr+8])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-') || (argv[argptr+5][0] == '-') || (argv[argptr+6][0] == '-')) {
                           ExitFlag = 255;
-                          DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C P <Z1> <x> <y> <z> <output> <bin output>" << endl);
+                          DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C P <Z1> <x> <y> <z> <output> <bin output> <binstart> <binend>" << endl);
                           performCriticalExit();
                         } else {
@@ -1841,5 +1839,5 @@
                           else
                             correlationmap = CorrelationToPoint(molecules, elemental, Point);
-                          //OutputCorrelationToSurface(&output, correlationmap);
+                          OutputCorrelationToPoint(&output, correlationmap);
                           BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd );
                           OutputCorrelation ( &binoutput, binmap );
@@ -1882,10 +1880,10 @@
                           int counter  = 0;
                           for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
-                            if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
+                            if ((Boundary == NULL) || (Boundary->getAtomCount() < (*BigFinder)->getAtomCount())) {
                               Boundary = *BigFinder;
                             }
                             counter++;
                           }
-                          bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
+                          bool *Actives = new bool[counter];
                           counter = 0;
                           for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
@@ -1913,7 +1911,8 @@
                           output.close();
                           binoutput.close();
+                          counter = 0;
                           for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
                             (*BigFinder)->ActiveFlag = Actives[counter++];
-                          Free(&Actives);
+                          delete[](Actives);
                           delete(LCList);
                           delete(TesselStruct);
@@ -1941,4 +1940,5 @@
                 performCriticalExit();
               } else {
+                mol->getAtomCount();
                 SaveFlag = true;
                 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl);
@@ -1950,52 +1950,19 @@
             case 'F':
               if (ExitFlag == 0) ExitFlag = 1;
-              MaxDistance = -1;
-              if (argv[argptr-1][2] == 'F') { // option is -FF?
-                // fetch first argument as max distance to surface
-                MaxDistance = atof(argv[argptr++]);
-                DoLog(0) && (Log() << Verbose(0) << "Filling with maximum layer distance of " << MaxDistance << "." << endl);
-              }
-              if ((argptr+7 >=argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (!IsValidNumber(argv[argptr+7]))) {
-                ExitFlag = 255;
-                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <xyz of filler> <dist_x> <dist_y> <dist_z> <boundary> <randatom> <randmol> <DoRotate>" << endl);
-                performCriticalExit();
-              } else {
-                SaveFlag = true;
-                DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules." << endl);
-                // construct water molecule
-                molecule *filler = World::getInstance().createMolecule();
-                if (!filler->AddXYZFile(argv[argptr])) {
-                  DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << argv[argptr] << "." << endl);
-                }
-                filler->SetNameFromFilename(argv[argptr]);
-                configuration.BG->ConstructBondGraph(filler);
-                molecule *Filling = NULL;
-                atom *second = NULL, *third = NULL;
-                first = World::getInstance().createAtom();
-                first->type = periode->FindElement(1);
-                first->x = Vector(0.441, -0.143, 0.);
-                filler->AddAtom(first);
-                second = World::getInstance().createAtom();
-                second->type = periode->FindElement(1);
-                second->x = Vector(-0.464, 1.137, 0.0);
-                filler->AddAtom(second);
-                third = World::getInstance().createAtom();
-                third->type = periode->FindElement(8);
-                third->x = Vector(-0.464, 0.177, 0.);
-                filler->AddAtom(third);
-                filler->AddBond(first, third, 1);
-                filler->AddBond(second, third, 1);
-                // call routine
-                double distance[NDIM];
-                for (int i=0;i<NDIM;i++)
-                  distance[i] = atof(argv[argptr+i+1]);
-                Filling = FillBoxWithMolecule(molecules, filler, configuration, MaxDistance, distance, atof(argv[argptr+4]), atof(argv[argptr+5]), atof(argv[argptr+6]), atoi(argv[argptr+7]));
-                if (Filling != NULL) {
-                  Filling->ActiveFlag = false;
-                  molecules->insert(Filling);
-                }
-                World::getInstance().destroyMolecule(filler);
-                argptr+=6;
-              }
+              ArgcList.insert(argptr-1);
+              ArgcList.insert(argptr);
+              ArgcList.insert(argptr+1);
+              ArgcList.insert(argptr+2);
+              ArgcList.insert(argptr+3);
+              ArgcList.insert(argptr+4);
+              ArgcList.insert(argptr+5);
+              ArgcList.insert(argptr+6);
+              ArgcList.insert(argptr+7);
+              ArgcList.insert(argptr+8);
+              ArgcList.insert(argptr+9);
+              ArgcList.insert(argptr+10);
+              ArgcList.insert(argptr+11);
+              ArgcList.insert(argptr+12);
+              argptr+=13;
               break;
             case 'A':
@@ -2007,7 +1974,7 @@
               } else {
                 DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl);
-                ifstream *input = new ifstream(argv[argptr]);
-                mol->CreateAdjacencyListFromDbondFile(input);
-                input->close();
+                ifstream input(argv[argptr]);
+                mol->CreateAdjacencyListFromDbondFile(&input);
+                input.close();
                 argptr+=1;
               }
@@ -2059,11 +2026,10 @@
                 int counter  = 0;
                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
-                  (*BigFinder)->CountAtoms();
-                  if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
+                  if ((Boundary == NULL) || (Boundary->getAtomCount() < (*BigFinder)->getAtomCount())) {
                     Boundary = *BigFinder;
                   }
                   counter++;
                 }
-                DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl);
+                DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->getAtomCount() << " atoms." << endl);
                 start = clock();
                 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.);
@@ -2100,5 +2066,5 @@
               if ((argptr >= argc) || (argv[argptr][0] == '-')) {
                 ExitFlag = 255;
-                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl);
+                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for linear interpolation: -L <step0> <step1> <prefix> <identity mapping?>" << endl);
                 performCriticalExit();
               } else {
@@ -2132,26 +2098,25 @@
             case 'R':
               if (ExitFlag == 0) ExitFlag = 1;
-              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])))  {
+              if ((argptr+3 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])))  {
                 ExitFlag = 255;
-                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl);
+                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <x> <y> <z> <distance>" << endl);
                 performCriticalExit();
               } else {
                 SaveFlag = true;
-                DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl);
-                double tmp1 = atof(argv[argptr+1]);
-                atom *third = mol->FindAtom(atoi(argv[argptr]));
-                atom *first = mol->start;
-                if ((third != NULL) && (first != mol->end)) {
-                  atom *second = first->next;
-                  while(second != mol->end) {
-                    first = second;
-                    second = first->next;
-                    if (first->x.DistanceSquared(third->x) > tmp1*tmp1) // distance to first above radius ...
-                      mol->RemoveAtom(first);
+                const double radius = atof(argv[argptr+3]);
+                Vector point(atof(argv[argptr]),atof(argv[argptr+1]),atof(argv[argptr+2]));
+                DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << point << " with radius " << radius << "." << endl);
+                atom *Walker = NULL;
+                molecule::iterator advancer = mol->begin();
+                for(molecule::iterator iter = advancer; advancer != mol->end();) {
+                  iter = advancer++;
+                  if ((*iter)->x.DistanceSquared(point) > radius*radius){ // distance to first above radius ...
+                    Walker = (*iter);
+                    DoLog(1) && (Log() << Verbose(1) << "Removing atom " << *Walker << "." << endl);
+                    mol->RemoveAtom(*(iter));
+                    World::getInstance().destroyAtom(Walker);
                   }
-                } else {
-                  DoeLog(1) && (eLog()<< Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl);
                 }
-                argptr+=2;
+                argptr+=4;
               }
               break;
@@ -2190,24 +2155,13 @@
             case 's':
               if (ExitFlag == 0) ExitFlag = 1;
-              if ((argptr >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
+              if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
                 ExitFlag = 255;
                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl);
                 performCriticalExit();
               } else {
-                SaveFlag = true;
-                j = -1;
-                DoLog(1) && (Log() << Verbose(1) << "Scaling all ion positions by factor." << endl);
-                factor = new double[NDIM];
-                factor[0] = atof(argv[argptr]);
-                factor[1] = atof(argv[argptr+1]);
-                factor[2] = atof(argv[argptr+2]);
-                mol->Scale((const double ** const)&factor);
-                double * const cell_size = World::getInstance().getDomain();
-                for (int i=0;i<NDIM;i++) {
-                  j += i+1;
-                  x[i] = atof(argv[NDIM+i]);
-                  cell_size[j]*=factor[i];
-                }
-                delete[](factor);
+                ArgcList.insert(argptr-1);
+                ArgcList.insert(argptr);
+                ArgcList.insert(argptr+1);
+                ArgcList.insert(argptr+2);
                 argptr+=3;
               }
@@ -2220,13 +2174,11 @@
                 performCriticalExit();
               } else {
-                SaveFlag = true;
-                j = -1;
-                DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl);
-                double * const cell_size = World::getInstance().getDomain();
-                for (int i=0;i<6;i++) {
-                  cell_size[i] = atof(argv[argptr+i]);
-                }
-                // center
-                mol->CenterInBox();
+                ArgcList.insert(argptr-1);
+                ArgcList.insert(argptr);
+                ArgcList.insert(argptr+1);
+                ArgcList.insert(argptr+2);
+                ArgcList.insert(argptr+3);
+                ArgcList.insert(argptr+4);
+                ArgcList.insert(argptr+5);
                 argptr+=6;
               }
@@ -2239,13 +2191,11 @@
                 performCriticalExit();
               } else {
-                SaveFlag = true;
-                j = -1;
-                DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl);
-                double * const cell_size = World::getInstance().getDomain();
-                for (int i=0;i<6;i++) {
-                  cell_size[i] = atof(argv[argptr+i]);
-                }
-                // center
-                mol->BoundInBox();
+                ArgcList.insert(argptr-1);
+                ArgcList.insert(argptr);
+                ArgcList.insert(argptr+1);
+                ArgcList.insert(argptr+2);
+                ArgcList.insert(argptr+3);
+                ArgcList.insert(argptr+4);
+                ArgcList.insert(argptr+5);
                 argptr+=6;
               }
@@ -2258,20 +2208,8 @@
                 performCriticalExit();
               } else {
-                SaveFlag = true;
-                j = -1;
-                DoLog(1) && (Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl);
-                // make every coordinate positive
-                mol->CenterEdge(&x);
-                // update Box of atoms by boundary
-                mol->SetBoxDimension(&x);
-                // translate each coordinate by boundary
-                double * const cell_size = World::getInstance().getDomain();
-                j=-1;
-                for (int i=0;i<NDIM;i++) {
-                  j += i+1;
-                  x[i] = atof(argv[argptr+i]);
-                  cell_size[j] += x[i]*2.;
-                }
-                mol->Translate((const Vector *)&x);
+                ArgcList.insert(argptr-1);
+                ArgcList.insert(argptr);
+                ArgcList.insert(argptr+1);
+                ArgcList.insert(argptr+2);
                 argptr+=3;
               }
@@ -2279,9 +2217,5 @@
             case 'O':
               if (ExitFlag == 0) ExitFlag = 1;
-              SaveFlag = true;
-              DoLog(1) && (Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl);
-              x.Zero();
-              mol->CenterEdge(&x);
-              mol->SetBoxDimension(&x);
+              ArgcList.insert(argptr-1);
               argptr+=0;
               break;
@@ -2293,4 +2227,5 @@
                 performCriticalExit();
               } else {
+                mol->getAtomCount();
                 SaveFlag = true;
                 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl);
@@ -2312,5 +2247,5 @@
                 mol->CreateAdjacencyList(atof(argv[argptr]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
                 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);
-                if (mol->first->next != mol->last) {
+                if (mol->hasBondStructure()) {
                   ExitFlag = mol->FragmentMolecule(atoi(argv[argptr+1]), &configuration);
                 }
@@ -2401,53 +2336,9 @@
                 performCriticalExit();
               } else {
-                SaveFlag = true;
-                double * const cell_size = World::getInstance().getDomain();
-                for (int axis = 1; axis <= NDIM; axis++) {
-                  int faktor = atoi(argv[argptr++]);
-                  int count;
-                  const element ** Elements;
-                  Vector ** vectors;
-                  if (faktor < 1) {
-                    DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor mus be greater than 1!" << endl);
-                    faktor = 1;
-                  }
-                  mol->CountAtoms();  // recount atoms
-                  if (mol->AtomCount != 0) {  // if there is more than none
-                    count = mol->AtomCount;   // is changed becausing of adding, thus has to be stored away beforehand
-                    Elements = new const element *[count];
-                    vectors = new Vector *[count];
-                    j = 0;
-                    first = mol->start;
-                    while (first->next != mol->end) {  // make a list of all atoms with coordinates and element
-                      first = first->next;
-                      Elements[j] = first->type;
-                      vectors[j] = &first->x;
-                      j++;
-                    }
-                    if (count != j)
-                      DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
-                    x.Zero();
-                    y.Zero();
-                    y[abs(axis)-1] = cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
-                    for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
-                      x += y; // per factor one cell width further
-                      for (int k=count;k--;) { // go through every atom of the original cell
-                        first = World::getInstance().createAtom(); // create a new body
-                        first->x = (*vectors[k]) + x;
-                        first->type = Elements[k];  // insert original element
-                        mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
-                      }
-                    }
-                    // free memory
-                    delete[](Elements);
-                    delete[](vectors);
-                    // correct cell size
-                    if (axis < 0) { // if sign was negative, we have to translate everything
-                      x =(-(faktor-1)) * y;
-                      mol->Translate(&x);
-                    }
-                    cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
-                  }
-                }
+                ArgcList.insert(argptr-1);
+                ArgcList.insert(argptr);
+                ArgcList.insert(argptr+1);
+                ArgcList.insert(argptr+2);
+                argptr+=3;
               }
               break;
@@ -2461,5 +2352,5 @@
     } while (argptr < argc);
     if (SaveFlag)
-      configuration.SaveAll(ConfigFileName, periode, molecules);
+      configuration.SaveAll(*ConfigFileName, periode, molecules);
   } else {  // no arguments, hence scan the elements db
     if (periode->LoadPeriodentafel(configuration.databasepath))
@@ -2476,9 +2367,4 @@
 void cleanUp(){
   World::purgeInstance();
-  Log() << Verbose(0) <<  "Maximum of allocated memory: "
-    << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
-  Log() << Verbose(0) <<  "Remaining non-freed memory: "
-    << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
   errorLogger::purgeInstance();
@@ -2488,4 +2374,5 @@
   ActionRegistry::purgeInstance();
   ActionHistory::purgeInstance();
+  Memory::getState();
 }
 
@@ -2493,4 +2380,7 @@
 {
     config *configuration = World::getInstance().getConfig();
+    // while we are non interactive, we want to abort from asserts
+    //ASSERT_DO(Assert::Abort);
+    molecule *mol = NULL;
     Vector x, y, z, n;
     ifstream test;
@@ -2499,5 +2389,7 @@
     char **Arguments = NULL;
     int ArgcSize = 0;
+    int ExitFlag = 0;
     bool ArgumentsCopied = false;
+    char *ConfigFileName = new char[MAXSTRINGSIZE];
 
     // print version check whether arguments are present at all
@@ -2505,4 +2397,6 @@
     if (argc < 2) {
       cout << "Obtain help with " << argv[0] << " -h." << endl;
+      cleanUp();
+      Memory::getState();
       return(1);
     }
@@ -2512,4 +2406,11 @@
     // need to init the history before any action is created
     ActionHistory::init();
+
+    // In the interactive mode, we can leave the user the choice in case of error
+    ASSERT_DO(Assert::Ask);
+
+    // from this moment on, we need to be sure to deeinitialize in the correct order
+    // this is handled by the cleanup function
+    atexit(cleanUp);
 
     // Parse command line options and if present create respective UI
@@ -2518,12 +2419,11 @@
       ArgcList.insert(0); // push back program!
       ArgcList.insert(1); // push back config file name
-      char ConfigFileName[MAXSTRINGSIZE];
       // handle arguments by ParseCommandLineOptions()
-      ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), (char *&)ConfigFileName, ArgcList);
+      ExitFlag = ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), &ConfigFileName, ArgcList);
       // copy all remaining arguments to a new argv
-      Arguments = Malloc<char *>(ArgcList.size(), "main - **Arguments");
+      Arguments = new char *[ArgcList.size()];
       cout << "The following arguments are handled by CommandLineParser: ";
       for (set<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) {
-        Arguments[ArgcSize] = Malloc<char>(strlen(argv[*ArgcRunner])+2, "main - *Arguments[]");
+        Arguments[ArgcSize] = new char[strlen(argv[*ArgcRunner])+2];
         strcpy(Arguments[ArgcSize], argv[*ArgcRunner]);
         cout << " " << argv[*ArgcRunner];
@@ -2550,20 +2450,16 @@
     }
 
-    if(World::getInstance().getPeriode()->StorePeriodentafel(configuration->databasepath))
-        Log() << Verbose(0) << "Saving of elements.db successful." << endl;
-
-    else
-        Log() << Verbose(0) << "Saving of elements.db failed." << endl;
+    Log() << Verbose(0) << "Saving to " << ConfigFileName << "." << endl;
+    World::getInstance().getConfig()->SaveAll(ConfigFileName, World::getInstance().getPeriode(), World::getInstance().getMolecules());
 
   // free the new argv
   if (ArgumentsCopied) {
     for (int i=0; i<ArgcSize;i++)
-      Free(&Arguments[i]);
-    Free(&Arguments);
+      delete[](Arguments[i]);
+    delete[](Arguments);
   }
-
-  cleanUp();
-  Memory::getState();
-  return (0);
+  delete[](ConfigFileName);
+
+  return (ExitFlag == 1 ? 0 : ExitFlag);
 }
 
Index: src/config.cpp
===================================================================
--- src/config.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/config.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -14,4 +14,5 @@
 #include "element.hpp"
 #include "helpers.hpp"
+#include "info.hpp"
 #include "lists.hpp"
 #include "log.hpp"
@@ -93,5 +94,5 @@
     return;
   } else
-    buffer = Malloc<char*>(NoLines, "ConfigFileBuffer::ConfigFileBuffer: **buffer");
+    buffer = new char *[NoLines];
 
   // scan each line and put into buffer
@@ -99,5 +100,5 @@
   int i;
   do {
-    buffer[lines] = Malloc<char>(MAXSTRINGSIZE, "ConfigFileBuffer::ConfigFileBuffer: *buffer[]");
+    buffer[lines] = new char[MAXSTRINGSIZE];
     file->getline(buffer[lines], MAXSTRINGSIZE-1);
     i = strlen(buffer[lines]);
@@ -119,7 +120,7 @@
 {
   for(int i=0;i<NoLines;++i)
-    Free(&buffer[i]);
-  Free(&buffer);
-  Free(&LineMapping);
+    delete[](buffer[i]);
+  delete[](buffer);
+  delete[](LineMapping);
 }
 
@@ -129,5 +130,5 @@
 void ConfigFileBuffer::InitMapping()
 {
-  LineMapping = Malloc<int>(NoLines, "ConfigFileBuffer::InitMapping: *LineMapping");
+  LineMapping = new int[NoLines];
   for (int i=0;i<NoLines;i++)
     LineMapping[i] = i;
@@ -179,10 +180,10 @@
     MaxLevel(5), RiemannTensor(0), LevRFactor(0), RiemannLevel(0), Lev0Factor(2), RTActualUse(0), AddPsis(0), RCut(20.), StructOpt(0), IsAngstroem(1), RelativeCoord(0),
     MaxTypes(0) {
-  mainname = Malloc<char>(MAXSTRINGSIZE,"config constructor: mainname");
-  defaultpath = Malloc<char>(MAXSTRINGSIZE,"config constructor: defaultpath");
-  pseudopotpath = Malloc<char>(MAXSTRINGSIZE,"config constructor: pseudopotpath");
-  databasepath = Malloc<char>(MAXSTRINGSIZE,"config constructor: databasepath");
-  configpath = Malloc<char>(MAXSTRINGSIZE,"config constructor: configpath");
-  configname = Malloc<char>(MAXSTRINGSIZE,"config constructor: configname");
+  mainname = new char[MAXSTRINGSIZE];
+  defaultpath = new char[MAXSTRINGSIZE];
+  pseudopotpath = new char[MAXSTRINGSIZE];
+  databasepath = new char[MAXSTRINGSIZE];
+  configpath = new char[MAXSTRINGSIZE];
+  configname = new char[MAXSTRINGSIZE];
   strcpy(mainname,"pcp");
   strcpy(defaultpath,"not specified");
@@ -199,14 +200,14 @@
 config::~config()
 {
-  Free(&mainname);
-  Free(&defaultpath);
-  Free(&pseudopotpath);
-  Free(&databasepath);
-  Free(&configpath);
-  Free(&configname);
-  Free(&ThermostatImplemented);
+  delete[](mainname);
+  delete[](defaultpath);
+  delete[](pseudopotpath);
+  delete[](databasepath);
+  delete[](configpath);
+  delete[](configname);
+  delete[](ThermostatImplemented);
   for (int j=0;j<MaxThermostats;j++)
-    Free(&ThermostatNames[j]);
-  Free(&ThermostatNames);
+    delete[](ThermostatNames[j]);
+  delete[](ThermostatNames);
 
   if (BG != NULL)
@@ -218,8 +219,8 @@
 void config::InitThermostats()
 {
-  ThermostatImplemented = Malloc<int>(MaxThermostats, "config constructor: *ThermostatImplemented");
-  ThermostatNames = Malloc<char*>(MaxThermostats, "config constructor: *ThermostatNames");
+  ThermostatImplemented = new int[MaxThermostats];
+  ThermostatNames = new char *[MaxThermostats];
   for (int j=0;j<MaxThermostats;j++)
-    ThermostatNames[j] = Malloc<char>(12, "config constructor: ThermostatNames[]");
+    ThermostatNames[j] = new char[12];
 
   strcpy(ThermostatNames[0],"None");
@@ -242,5 +243,5 @@
 void config::ParseThermostats(class ConfigFileBuffer * const fb)
 {
-  char * const thermo = Malloc<char>(12, "IonsInitRead: thermo");
+  char * const thermo = new char[12];
   const int verbose = 0;
 
@@ -309,5 +310,5 @@
     Thermostat = None;
   }
-  Free(thermo);
+  delete[](thermo);
 };
 
@@ -1547,5 +1548,4 @@
   int AtomNo = -1;
   int MolNo = 0;
-  atom *Walker = NULL;
   FILE *f = NULL;
 
@@ -1560,30 +1560,30 @@
   fprintf(f, "# Created by MoleCuilder\n");
 
-  for (MoleculeList::const_iterator Runner = MolList->ListOfMolecules.begin(); Runner != MolList->ListOfMolecules.end(); Runner++) {
-    Walker = (*Runner)->start;
-    int *elementNo = Calloc<int>(MAX_ELEMENTS, "config::SavePDB - elementNo");
+  for (MoleculeList::const_iterator MolRunner = MolList->ListOfMolecules.begin(); MolRunner != MolList->ListOfMolecules.end(); MolRunner++) {
+    int *elementNo = new int[MAX_ELEMENTS];
+    for (int i=0;i<MAX_ELEMENTS;i++)
+      elementNo[i] = 0;
     AtomNo = 0;
-    while (Walker->next != (*Runner)->end) {
-      Walker = Walker->next;
-      sprintf(name, "%2s%2d",Walker->type->symbol, elementNo[Walker->type->Z]);
-      elementNo[Walker->type->Z] = (elementNo[Walker->type->Z]+1) % 100;   // confine to two digits
+    for (molecule::const_iterator iter = (*MolRunner)->begin(); iter != (*MolRunner)->end(); ++iter) {
+      sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
+      elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
       fprintf(f,
              "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
-             Walker->nr,                /* atom serial number */
+             (*iter)->nr,                /* atom serial number */
              name,         /* atom name */
-             (*Runner)->name,      /* residue name */
+             (*MolRunner)->name,      /* residue name */
              'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
              MolNo,         /* residue sequence number */
-             Walker->node->at(0),                 /* position X in Angstroem */
-             Walker->node->at(1),                 /* position Y in Angstroem */
-             Walker->node->at(2),                 /* position Z in Angstroem */
-             (double)Walker->type->Valence,         /* occupancy */
-             (double)Walker->type->NoValenceOrbitals,          /* temperature factor */
+             (*iter)->node->at(0),                 /* position X in Angstroem */
+             (*iter)->node->at(1),                 /* position Y in Angstroem */
+             (*iter)->node->at(2),                 /* position Z in Angstroem */
+             (double)(*iter)->type->Valence,         /* occupancy */
+             (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
              "0",            /* segment identifier */
-             Walker->type->symbol,    /* element symbol */
+             (*iter)->type->symbol,    /* element symbol */
              "0");           /* charge */
       AtomNo++;
     }
-    Free(&elementNo);
+    delete[](elementNo);
     MolNo++;
   }
@@ -1601,8 +1601,9 @@
 {
   int AtomNo = -1;
-  atom *Walker = NULL;
   FILE *f = NULL;
 
-  int *elementNo = Calloc<int>(MAX_ELEMENTS, "config::SavePDB - elementNo");
+  int *elementNo = new int[MAX_ELEMENTS];
+  for (int i=0;i<MAX_ELEMENTS;i++)
+    elementNo[i] = 0;
   char name[MAXSTRINGSIZE];
   strncpy(name, filename, MAXSTRINGSIZE-1);
@@ -1611,34 +1612,32 @@
   if (f == NULL) {
     DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open pdb output file:" << name << endl);
-    Free(&elementNo);
+    delete[](elementNo);
     return false;
   }
   fprintf(f, "# Created by MoleCuilder\n");
 
-  Walker = mol->start;
   AtomNo = 0;
-  while (Walker->next != mol->end) {
-    Walker = Walker->next;
-    sprintf(name, "%2s%2d",Walker->type->symbol, elementNo[Walker->type->Z]);
-    elementNo[Walker->type->Z] = (elementNo[Walker->type->Z]+1) % 100;   // confine to two digits
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
+    elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
     fprintf(f,
            "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
-           Walker->nr,                /* atom serial number */
+           (*iter)->nr,                /* atom serial number */
            name,         /* atom name */
            mol->name,      /* residue name */
            'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
            0,         /* residue sequence number */
-           Walker->node->at(0),                 /* position X in Angstroem */
-           Walker->node->at(1),                 /* position Y in Angstroem */
-           Walker->node->at(2),                 /* position Z in Angstroem */
-           (double)Walker->type->Valence,         /* occupancy */
-           (double)Walker->type->NoValenceOrbitals,          /* temperature factor */
+           (*iter)->node->at(0),                 /* position X in Angstroem */
+           (*iter)->node->at(1),                 /* position Y in Angstroem */
+           (*iter)->node->at(2),                 /* position Z in Angstroem */
+           (double)(*iter)->type->Valence,         /* occupancy */
+           (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
            "0",            /* segment identifier */
-           Walker->type->symbol,    /* element symbol */
+           (*iter)->type->symbol,    /* element symbol */
            "0");           /* charge */
     AtomNo++;
   }
   fclose(f);
-  Free(&elementNo);
+  delete[](elementNo);
 
   return true;
@@ -1653,5 +1652,4 @@
 bool config::SaveTREMOLO(const char * const filename, const molecule * const mol) const
 {
-  atom *Walker = NULL;
   ofstream *output = NULL;
   stringstream * const fname = new stringstream;
@@ -1666,27 +1664,23 @@
 
   // scan maximum number of neighbours
-  Walker = mol->start;
   int MaxNeighbours = 0;
-  while (Walker->next != mol->end) {
-    Walker = Walker->next;
-    const int count = Walker->ListOfBonds.size();
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    const int count = (*iter)->ListOfBonds.size();
     if (MaxNeighbours < count)
       MaxNeighbours = count;
   }
-  *output << "# ATOMDATA Id name resName resSeq x=3 charge type neighbors=" << MaxNeighbours << endl;
-
-  Walker = mol->start;
-  while (Walker->next != mol->end) {
-    Walker = Walker->next;
-    *output << Walker->nr << "\t";
-    *output << Walker->Name << "\t";
+  *output << "# ATOMDATA Id name resName resSeq x=3 Charge type neighbors=" << MaxNeighbours << endl;
+
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    *output << (*iter)->nr << "\t";
+    *output << (*iter)->getName() << "\t";
     *output << mol->name << "\t";
     *output << 0 << "\t";
-    *output << Walker->node->at(0) << "\t" << Walker->node->at(1) << "\t" << Walker->node->at(2) << "\t";
-    *output << static_cast<double>(Walker->type->Valence) << "\t";
-    *output << Walker->type->symbol << "\t";
-    for (BondList::iterator runner = Walker->ListOfBonds.begin(); runner != Walker->ListOfBonds.end(); runner++)
-      *output << (*runner)->GetOtherAtom(Walker)->nr << "\t";
-    for(int i=Walker->ListOfBonds.size(); i < MaxNeighbours; i++)
+    *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
+    *output << static_cast<double>((*iter)->type->Valence) << "\t";
+    *output << (*iter)->type->symbol << "\t";
+    for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
+      *output << (*runner)->GetOtherAtom(*iter)->nr << "\t";
+    for(int i=(*iter)->ListOfBonds.size(); i < MaxNeighbours; i++)
       *output << "-\t";
     *output << endl;
@@ -1708,5 +1702,5 @@
 bool config::SaveTREMOLO(const char * const filename, const MoleculeListClass * const MolList) const
 {
-  atom *Walker = NULL;
+  Info FunctionInfo(__func__);
   ofstream *output = NULL;
   stringstream * const fname = new stringstream;
@@ -1723,26 +1717,24 @@
   int MaxNeighbours = 0;
   for (MoleculeList::const_iterator MolWalker = MolList->ListOfMolecules.begin(); MolWalker != MolList->ListOfMolecules.end(); MolWalker++) {
-    Walker = (*MolWalker)->start;
-    while (Walker->next != (*MolWalker)->end) {
-      Walker = Walker->next;
-      const int count = Walker->ListOfBonds.size();
+    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
+      const int count = (*iter)->ListOfBonds.size();
       if (MaxNeighbours < count)
         MaxNeighbours = count;
     }
   }
-  *output << "# ATOMDATA Id name resName resSeq x=3 charge type neighbors=" << MaxNeighbours << endl;
+  *output << "# ATOMDATA Id name resName resSeq x=3 Charge type neighbors=" << MaxNeighbours << endl;
 
   // create global to local id map
-  int **LocalNotoGlobalNoMap = Calloc<int *>(MolList->ListOfMolecules.size(), "config::SaveTREMOLO - **LocalNotoGlobalNoMap");
+  map<int, int> LocalNotoGlobalNoMap;
   {
-    int MolCounter = 0;
-    int AtomNo = 0;
+    unsigned int MolCounter = 0;
+    int AtomNo = 1;
     for (MoleculeList::const_iterator MolWalker = MolList->ListOfMolecules.begin(); MolWalker != MolList->ListOfMolecules.end(); MolWalker++) {
-      LocalNotoGlobalNoMap[MolCounter] = Calloc<int>(MolList->CountAllAtoms(), "config::SaveTREMOLO - *LocalNotoGlobalNoMap[]");
-
-      (*MolWalker)->SetIndexedArrayForEachAtomTo( LocalNotoGlobalNoMap[MolCounter], &atom::nr, IncrementalAbsoluteValue, &AtomNo);
-
+      for(molecule::iterator AtomRunner = (*MolWalker)->begin(); AtomRunner != (*MolWalker)->end(); ++AtomRunner) {
+        LocalNotoGlobalNoMap.insert( pair<int,int>((*AtomRunner)->getId(), AtomNo++) );
+      }
       MolCounter++;
     }
+    ASSERT(MolCounter == MolList->ListOfMolecules.size(), "SaveTREMOLO: LocalNotoGlobalNoMap[] has not been correctly initialized for each molecule");
   }
 
@@ -1752,17 +1744,15 @@
     int AtomNo = 0;
     for (MoleculeList::const_iterator MolWalker = MolList->ListOfMolecules.begin(); MolWalker != MolList->ListOfMolecules.end(); MolWalker++) {
-      Walker = (*MolWalker)->start;
-      while (Walker->next != (*MolWalker)->end) {
-        Walker = Walker->next;
-        *output << AtomNo+1 << "\t";
-        *output << Walker->Name << "\t";
+      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
+        *output << LocalNotoGlobalNoMap[ (*iter)->getId() ] << "\t";
+        *output << (*iter)->getName() << "\t";
         *output << (*MolWalker)->name << "\t";
         *output << MolCounter+1 << "\t";
-        *output << Walker->node->at(0) << "\t" << Walker->node->at(1) << "\t" << Walker->node->at(2) << "\t";
-        *output << (double)Walker->type->Valence << "\t";
-        *output << Walker->type->symbol << "\t";
-        for (BondList::iterator runner = Walker->ListOfBonds.begin(); runner != Walker->ListOfBonds.end(); runner++)
-          *output << LocalNotoGlobalNoMap[MolCounter][ (*runner)->GetOtherAtom(Walker)->nr ]+1 << "\t";
-        for(int i=Walker->ListOfBonds.size(); i < MaxNeighbours; i++)
+        *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
+        *output << (double)(*iter)->type->Valence << "\t";
+        *output << (*iter)->type->symbol << "\t";
+        for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
+          *output << LocalNotoGlobalNoMap[ (*runner)->GetOtherAtom((*iter))->getId() ] << "\t";
+        for(int i=(*iter)->ListOfBonds.size(); i < MaxNeighbours; i++)
           *output << "-\t";
         *output << endl;
@@ -1778,7 +1768,4 @@
   delete(output);
   delete(fname);
-  for(size_t i=0;i<MolList->ListOfMolecules.size(); i++)
-    Free(&LocalNotoGlobalNoMap[i]);
-  Free(&LocalNotoGlobalNoMap);
 
   return true;
@@ -1808,9 +1795,9 @@
   if (output == NULL)
     strcpy(filename,"main_pcp_linux");
-  Log() << Verbose(0) << "Saving as pdb input ";
+  Log() << Verbose(0) << "Saving as pdb input ... " << endl;
   if (SavePDB(filename, molecules))
-    Log() << Verbose(0) << "done." << endl;
+    Log() << Verbose(0) << "\t... done." << endl;
   else
-    Log() << Verbose(0) << "failed." << endl;
+    Log() << Verbose(0) << "\t... failed." << endl;
 
   // then save as tremolo data file
@@ -1819,9 +1806,9 @@
   if (output == NULL)
     strcpy(filename,"main_pcp_linux");
-  Log() << Verbose(0) << "Saving as tremolo data input ";
+  Log() << Verbose(0) << "Saving as tremolo data input ... " << endl;
   if (SaveTREMOLO(filename, molecules))
-    Log() << Verbose(0) << "done." << endl;
+    Log() << Verbose(0) << "\t... done." << endl;
   else
-    Log() << Verbose(0) << "failed." << endl;
+    Log() << Verbose(0) << "\t... failed." << endl;
 
   // translate each to its center and merge all molecules in MoleculeListClass into this molecule
@@ -1859,9 +1846,9 @@
   output.close();
   output.clear();
-  Log() << Verbose(0) << "Saving of config file ";
+  Log() << Verbose(0) << "Saving of config file ... " << endl;
   if (Save(filename, periode, mol))
-    Log() << Verbose(0) << "successful." << endl;
+    Log() << Verbose(0) << "\t... successful." << endl;
   else
-    Log() << Verbose(0) << "failed." << endl;
+    Log() << Verbose(0) << "\t... failed." << endl;
 
   // and save to xyz file
@@ -1876,15 +1863,15 @@
     output.open(filename, ios::trunc);
   }
-  Log() << Verbose(0) << "Saving of XYZ file ";
+  Log() << Verbose(0) << "Saving of XYZ file ... " << endl;
   if (mol->MDSteps <= 1) {
     if (mol->OutputXYZ(&output))
-      Log() << Verbose(0) << "successful." << endl;
+      Log() << Verbose(0) << "\t... successful." << endl;
     else
-      Log() << Verbose(0) << "failed." << endl;
+      Log() << Verbose(0) << "\t... failed." << endl;
   } else {
     if (mol->OutputTrajectoriesXYZ(&output))
-      Log() << Verbose(0) << "successful." << endl;
+      Log() << Verbose(0) << "\t... successful." << endl;
     else
-      Log() << Verbose(0) << "failed." << endl;
+      Log() << Verbose(0) << "\t... failed." << endl;
   }
   output.close();
@@ -1896,9 +1883,9 @@
   if (output == NULL)
     strcpy(filename,"main_pcp_linux");
-  Log() << Verbose(0) << "Saving as mpqc input ";
+  Log() << Verbose(0) << "Saving as mpqc input .. " << endl;
   if (SaveMPQC(filename, mol))
-    Log() << Verbose(0) << "done." << endl;
+    Log() << Verbose(0) << "\t... done." << endl;
   else
-    Log() << Verbose(0) << "failed." << endl;
+    Log() << Verbose(0) << "\t... failed." << endl;
 
   if (!strcmp(configpath, GetDefaultPath())) {
@@ -1938,5 +1925,5 @@
   char *dummy1 = NULL;
   char *dummy = NULL;
-  char * const free_dummy = Malloc<char>(256, "config::ParseForParameter: *free_dummy");    // pointers in the line that is read in per step
+  char free_dummy[MAXSTRINGSIZE];    // pointers in the line that is read in per step
   dummy1 = free_dummy;
 
@@ -1954,5 +1941,4 @@
       if (file->eof()) {
         if ((critical) && (found == 0)) {
-          Free(free_dummy);
           //Error(InitReading, name);
           fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
@@ -1962,5 +1948,4 @@
           file->clear();
           file->seekg(file_position, ios::beg);  // rewind to start position
-          Free(free_dummy);
           return 0;
         }
@@ -1993,5 +1978,4 @@
         dummy = strchr(dummy1, '\n'); // set on line end then (whole line = keyword)
         //fprintf(stderr,"Error: Cannot find tabs or spaces on line %i in search for %s\n", line, name);
-        //Free((void **)&free_dummy);
         //Error(FileOpenParams, NULL);
       } else {
@@ -2014,5 +1998,4 @@
               if (file->eof()) {
                 if ((critical) && (found == 0)) {
-                  Free(free_dummy);
                   //Error(InitReading, name);
                   fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
@@ -2022,5 +2005,4 @@
                   file->clear();
                   file->seekg(file_position, ios::beg);  // rewind to start position
-                  Free(free_dummy);
                   return 0;
                 }
@@ -2063,5 +2045,4 @@
                   if (critical) {
                     if (verbose) fprintf(stderr,"Error: EoL at %i and still missing %i value(s) for parameter %s\n", line, yth-j, name);
-                    Free(free_dummy);
                     //return 0;
                     exit(255);
@@ -2071,5 +2052,4 @@
                     file->clear();
                     file->seekg(file_position, ios::beg);  // rewind to start position
-                    Free(free_dummy);
                     return 0;
                   }
@@ -2084,5 +2064,4 @@
                   file->seekg(file_position, ios::beg);  // rewind to start position
                 }
-                Free(free_dummy);
                 return 0;
               }
@@ -2140,5 +2119,4 @@
   if ((type >= row_int) && (verbose))
     fprintf(stderr,"\n");
-  Free(free_dummy);
   if (!sequential) {
     file->clear();
@@ -2221,5 +2199,4 @@
         dummy = strchr(dummy1, '\n'); // set on line end then (whole line = keyword)
         //fprintf(stderr,"Error: Cannot find tabs or spaces on line %i in search for %s\n", line, name);
-        //Free(&free_dummy);
         //Error(FileOpenParams, NULL);
       } else {
Index: src/helpers.cpp
===================================================================
--- src/helpers.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/helpers.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -58,5 +58,5 @@
 int CountLinesinFile(ifstream &InputFile)
 {
-  char *buffer = Malloc<char>(MAXSTRINGSIZE, "CountLinesinFile: *buffer");
+  char *buffer = new char[MAXSTRINGSIZE];
   int lines=0;
 
@@ -70,5 +70,5 @@
   }
   InputFile.seekg(PositionMarker, ios::beg);
-  Free(&buffer);
+  delete[](buffer);
   return lines;
 };
@@ -90,5 +90,5 @@
   }
   // allocate string
-  returnstring = Malloc<char>(order + 2, "FixedDigitNumber: *returnstring");
+  returnstring = new char[order + 2];
   // terminate  and fill string array from end backward
   returnstring[order] = '\0';
@@ -122,5 +122,5 @@
 double * ReturnFullMatrixforSymmetric(const double * const symm)
 {
-  double *matrix = Malloc<double>(NDIM * NDIM, "molecule::ReturnFullMatrixforSymmetric: *matrix");
+  double *matrix = new double[NDIM * NDIM];
   matrix[0] = symm[0];
   matrix[1] = symm[1];
@@ -140,5 +140,5 @@
 double * InverseMatrix( const double * const A)
 {
-  double *B = Malloc<double>(NDIM * NDIM, "Vector::InverseMatrix: *B");
+  double *B = new double[NDIM * NDIM];
   double detA = RDET3(A);
   double detAReci;
@@ -180,38 +180,8 @@
 
 
-/** Allocates a memory range using malloc().
- * Prints the provided error message in case of a failure.
- *
- * \param number of memory slices of type X to allocate
- * \param failure message which is printed if the allocation fails
- * \return pointer to the allocated memory range, will be NULL if a failure occurred
- */
-template <> char* Malloc<char>(size_t size, const char* output)
-{
-  char* buffer = NULL;
-  buffer = (char*) malloc(sizeof(char) * (size + 1));
-  for (size_t i = size; i--;)
-    buffer[i] = (i % 2 == 0) ? 'p': 'c';
-  buffer[size] = '\0';
-
-  if (buffer != NULL) {
-    MemoryUsageObserver::getInstance()->addMemory(buffer, size);
-  } else {
-    Log() << Verbose(0) << "Malloc for datatype " << typeid(char).name()
-      << " failed - pointer is NULL: " << output << endl;
-  }
-
-  return buffer;
-};
-
 /**
- * Frees all memory registered by the memory observer and calls exit(225) afterwards.
+ * Calls exit(255).
  */
 void performCriticalExit() {
-  map<void*, size_t> pointers = MemoryUsageObserver::getInstance()->getPointersToAllocatedMemory();
-  for (map<void*, size_t>::iterator runner = pointers.begin(); runner != pointers.end(); runner++) {
-    Free(((void**) &runner->first));
-  }
-
   exit(255);
 }
Index: src/helpers.hpp
===================================================================
--- src/helpers.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/helpers.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -97,5 +97,5 @@
 
   if (LookupTable != NULL) {
-    DoLog(0) && (Log() << Verbose(0) << "Pointer for Lookup table is not NULL! Aborting ..." <<endl);
+    DoeLog(0) && (eLog() << Verbose(0) << "Pointer for Lookup table is not NULL! Aborting ..." <<endl);
     return false;
   }
@@ -110,10 +110,10 @@
   }
   if (count <= 0) {
-    DoLog(0) && (Log() << Verbose(0) << "Count of lookup list is 0 or less." << endl);
+    DoeLog(1) && (eLog() << Verbose(1) << "Count of lookup list is 0 or less." << endl);
     return false;
   }
 
   // allocate and fill
-  LookupTable = Calloc<T*>(count, "CreateFatherLookupTable - **LookupTable");
+  LookupTable = new T*[count];
   if (LookupTable == NULL) {
     DoeLog(0) && (eLog()<< Verbose(0) << "LookupTable memory allocation failed!" << endl);
@@ -129,5 +129,5 @@
         LookupTable[AtomNo] = Walker;
       } else {
-        DoLog(0) && (Log() << Verbose(0) << "Walker " << *Walker << " exceeded range of nuclear ids [0, " << count << ")." << endl);
+        DoeLog(2) && (eLog() << Verbose(2) << "Walker " << *Walker << " exceeded range of nuclear ids [0, " << count << ")." << endl);
         status = false;
         break;
@@ -138,4 +138,5 @@
   return status;
 };
+
 
 /** Frees a two-dimensional array.
Index: src/joiner.cpp
===================================================================
--- src/joiner.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/joiner.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -58,5 +58,5 @@
     return 1;
   } else {
-    dir = Malloc<char>(strlen(argv[2]) + 2, "main: *dir");
+    dir = new char[strlen(argv[2]) + 2];
     strcpy(dir, "/");
     strcat(dir, argv[2]);
@@ -243,5 +243,5 @@
   // exit
   delete(periode);
-  Free(&dir);
+  delete[](dir);
   DoLog(0) && (Log() << Verbose(0) << "done." << endl);
   return 0;
Index: src/lists.cpp
===================================================================
--- src/lists.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ 	(revision )
@@ -1,21 +1,0 @@
-/*
- * lists.cpp
- *
- *  Created on: Feb 24, 2010
- *      Author: crueger
- */
-
-#include "lists.hpp"
-#include "World.hpp"
-#include "atom.hpp"
-
-// specialized templates for lists
-// can be directly compiled since no further templatization is needed
-template <> void removewithoutcheck<atom>(atom *walker)
-{
-  if (walker != 0) {
-    unlink(walker);
-    walker->getWorld()->destroyAtom(walker);
-    walker = 0;
-  }
-};
Index: src/lists.hpp
===================================================================
--- src/lists.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/lists.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -134,27 +134,3 @@
 };
 
-/** Returns the first marker in a chain list.
- * \param *me one arbitrary item in chain list
- * \return poiner to first marker
- */
-template <typename X> X *GetFirst(X *me)
-{
-  X *Binder = me;
-  while(Binder->previous != 0)
-    Binder = Binder->previous;
-  return Binder;
-};
-
-/** Returns the last marker in a chain list.
- * \param *me one arbitrary item in chain list
- * \return poiner to last marker
- */
-template <typename X> X *GetLast(X *me)
-{
-  X *Binder = me;
-  while(Binder->next != 0)
-    Binder = Binder->next;
-  return Binder;
-};
-
 #endif /* LISTS_HPP_ */
Index: src/memoryallocator.cpp
===================================================================
--- src/memoryallocator.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
+++ src/memoryallocator.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -0,0 +1,36 @@
+/*
+ * memoryallocator.cpp
+ *
+ *  Created on: May 31, 2010
+ *      Author: heber
+ */
+
+using namespace std;
+
+#include "memoryallocator.hpp"
+
+/** Allocates a memory range using malloc().
+ * Prints the provided error message in case of a failure.
+ *
+ * \param number of memory slices of type X to allocate
+ * \param failure message which is printed if the allocation fails
+ * \return pointer to the allocated memory range, will be NULL if a failure occurred
+ */
+template <> char* Malloc<char>(size_t size, const char* output)
+{
+  char* buffer = NULL;
+  buffer = (char*) malloc(sizeof(char) * (size + 1));
+  for (size_t i = size; i--;)
+    buffer[i] = (i % 2 == 0) ? 'p': 'c';
+  buffer[size] = '\0';
+
+  if (buffer != NULL) {
+    //MemoryUsageObserver::getInstance()->addMemory(buffer, size);
+  } else {
+    Log() << Verbose(0) << "Malloc for datatype " << typeid(char).name()
+      << " failed - pointer is NULL: " << output << endl;
+  }
+
+  return buffer;
+};
+
Index: src/molecule.cpp
===================================================================
--- src/molecule.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/molecule.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -35,19 +35,11 @@
  * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero.
  */
-molecule::molecule(const periodentafel * const teil) : elemente(teil), start(World::getInstance().createAtom()), end(World::getInstance().createAtom()),
-  first(new bond(start, end, 1, -1)), last(new bond(start, end, 1, -1)), MDSteps(0), AtomCount(0), 
+molecule::molecule(const periodentafel * const teil) : elemente(teil),
+  MDSteps(0),
   BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.), 
   ActiveFlag(false), IndexNr(-1),
   formula(this,boost::bind(&molecule::calcFormula,this)),
-  last_atom(0),
-  InternalPointer(start)
-{
-  // init atom chain list
-  start->father = NULL;
-  end->father = NULL;
-  link(start,end);
-
-  // init bond chain list
-  link(first,last);
+  AtomCount(this,boost::bind(&molecule::doCountAtoms,this)), last_atom(0),  InternalPointer(begin())
+{
 
   // other stuff
@@ -67,8 +59,4 @@
 {
   CleanupMolecule();
-  delete(first);
-  delete(last);
-  end->getWorld()->destroyAtom(end);
-  start->getWorld()->destroyAtom(start);
 };
 
@@ -81,4 +69,8 @@
 const std::string molecule::getName(){
   return std::string(name);
+}
+
+int molecule::getAtomCount() const{
+  return *AtomCount;
 }
 
@@ -104,6 +96,6 @@
   stringstream sstr;
   periodentafel *periode = World::getInstance().getPeriode();
-  for(atom *Walker = start; Walker != end; Walker = Walker->next) {
-    counts[Walker->type->getNumber()]++;
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    counts[(*iter)->type->getNumber()]++;
   }
   std::map<atomicNumber_t,unsigned int>::reverse_iterator iter;
@@ -115,4 +107,65 @@
 }
 
+/************************** Access to the List of Atoms ****************/
+
+
+molecule::iterator molecule::begin(){
+  return molecule::iterator(atoms.begin(),this);
+}
+
+molecule::const_iterator molecule::begin() const{
+  return atoms.begin();
+}
+
+molecule::iterator molecule::end(){
+  return molecule::iterator(atoms.end(),this);
+}
+
+molecule::const_iterator molecule::end() const{
+  return atoms.end();
+}
+
+bool molecule::empty() const
+{
+  return (begin() == end());
+}
+
+size_t molecule::size() const
+{
+  size_t counter = 0;
+  for (molecule::const_iterator iter = begin(); iter != end (); ++iter)
+    counter++;
+  return counter;
+}
+
+molecule::const_iterator molecule::erase( const_iterator loc )
+{
+  molecule::const_iterator iter = loc;
+  iter--;
+  atoms.erase( loc );
+  return iter;
+}
+
+molecule::const_iterator molecule::erase( atom *& key )
+{
+  cout << "trying to erase atom" << endl;
+  molecule::const_iterator iter = find(key);
+  if (iter != end()){
+    // remove this position and step forward (post-increment)
+    atoms.erase( iter++ );
+  }
+  return iter;
+}
+
+molecule::const_iterator molecule::find ( atom *& key ) const
+{
+  return atoms.find( key );
+}
+
+pair<molecule::iterator,bool> molecule::insert ( atom * const key )
+{
+  pair<atomSet::iterator,bool> res = atoms.insert(key);
+  return pair<iterator,bool>(iterator(res.first,this),res.second);
+}
 
 /** Adds given atom \a *pointer from molecule list.
@@ -123,10 +176,7 @@
 bool molecule::AddAtom(atom *pointer)
 {
-  bool retval = false;
   OBSERVE;
   if (pointer != NULL) {
     pointer->sort = &pointer->nr;
-    pointer->nr = last_atom++;  // increase number within molecule
-    AtomCount++;
     if (pointer->type != NULL) {
       if (ElementsInMolecule[pointer->type->Z] == 0)
@@ -135,13 +185,13 @@
       if (pointer->type->Z != 1)
         NoNonHydrogen++;
-      if (pointer->Name == NULL) {
-        Free(&pointer->Name);
-        pointer->Name = Malloc<char>(6, "molecule::AddAtom: *pointer->Name");
-        sprintf(pointer->Name, "%2s%02d", pointer->type->symbol, pointer->nr+1);
-      }
-    }
-    retval = add(pointer, end);
-  }
-  return retval;
+      if(pointer->getName() == "Unknown"){
+        stringstream sstr;
+        sstr << pointer->type->symbol << pointer->nr+1;
+        pointer->setName(sstr.str());
+      }
+    }
+    insert(pointer);
+  }
+  return true;
 };
 
@@ -157,11 +207,9 @@
   if (pointer != NULL) {
     atom *walker = pointer->clone();
-    walker->Name = Malloc<char>(strlen(pointer->Name) + 1, "atom::atom: *Name");
-    strcpy (walker->Name, pointer->Name);
+    walker->setName(pointer->getName());
     walker->nr = last_atom++;  // increase number within molecule
-    add(walker, end);
+    insert(walker);
     if ((pointer->type != NULL) && (pointer->type->Z != 1))
       NoNonHydrogen++;
-    AtomCount++;
     retval=walker;
   }
@@ -241,5 +289,5 @@
     Orthovector1.MatrixMultiplication(matrix);
     InBondvector -= Orthovector1; // subtract just the additional translation
-    Free(&matrix);
+    delete[](matrix);
     bondlength = InBondvector.Norm();
 //    Log() << Verbose(4) << "Corrected InBondvector is now: ";
@@ -250,7 +298,8 @@
   InBondvector.Normalize();
   // get typical bond length and store as scale factor for later
+  ASSERT(TopOrigin->type != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given.");
   BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1];
   if (BondRescale == -1) {
-    DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl);
+    DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
     return false;
     BondRescale = bondlength;
@@ -275,5 +324,5 @@
       InBondvector *= BondRescale;   // rescale the distance vector to Hydrogen bond length
       FirstOtherAtom->x = TopOrigin->x; // set coordination to origin ...
-      FirstOtherAtom->x = InBondvector;  // ... and add distance vector to replacement atom
+      FirstOtherAtom->x += InBondvector;  // ... and add distance vector to replacement atom
       AllWentWell = AllWentWell && AddAtom(FirstOtherAtom);
 //      Log() << Verbose(4) << "Added " << *FirstOtherAtom << " at: ";
@@ -295,5 +344,5 @@
             SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin);
           } else {
-            DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->Name);
+            DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->getName());
           }
         }
@@ -339,5 +388,5 @@
       bondangle = TopOrigin->type->HBondAngle[1];
       if (bondangle == -1) {
-        DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl);
+        DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
         return false;
         bondangle = 0;
@@ -471,5 +520,5 @@
       break;
   }
-  Free(&matrix);
+  delete[](matrix);
 
 //  Log() << Verbose(3) << "End of AddHydrogenReplacementAtom." << endl;
@@ -554,26 +603,27 @@
 
   // copy all bonds
-  bond *Binder = first;
+  bond *Binder = NULL;
   bond *NewBond = NULL;
-  while(Binder->next != last) {
-    Binder = Binder->next;
-
-    // get the pendant atoms of current bond in the copy molecule
-    copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->leftatom, (const atom **)&LeftAtom );
-    copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->rightatom, (const atom **)&RightAtom );
-
-    NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree);
-    NewBond->Cyclic = Binder->Cyclic;
-    if (Binder->Cyclic)
-      copy->NoCyclicBonds++;
-    NewBond->Type = Binder->Type;
-  }
+  for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
+    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
+      if ((*BondRunner)->leftatom == *AtomRunner) {
+        Binder = (*BondRunner);
+
+        // get the pendant atoms of current bond in the copy molecule
+        copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->leftatom, (const atom **)&LeftAtom );
+        copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->rightatom, (const atom **)&RightAtom );
+
+        NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree);
+        NewBond->Cyclic = Binder->Cyclic;
+        if (Binder->Cyclic)
+          copy->NoCyclicBonds++;
+        NewBond->Type = Binder->Type;
+      }
   // correct fathers
   ActOnAllAtoms( &atom::CorrectFather );
 
   // copy values
-  copy->CountAtoms();
   copy->CountElements();
-  if (first->next != last) {  // if adjaceny list is present
+  if (hasBondStructure()) {  // if adjaceny list is present
     copy->BondDistance = BondDistance;
   }
@@ -608,14 +658,17 @@
 {
   bond *Binder = NULL;
-  if ((atom1 != NULL) && (FindAtom(atom1->nr) != NULL) && (atom2 != NULL) && (FindAtom(atom2->nr) != NULL)) {
-    Binder = new bond(atom1, atom2, degree, BondCount++);
-    atom1->RegisterBond(Binder);
-    atom2->RegisterBond(Binder);
-    if ((atom1->type != NULL) && (atom1->type->Z != 1) && (atom2->type != NULL) && (atom2->type->Z != 1))
-      NoNonBonds++;
-    add(Binder, last);
-  } else {
-    DoeLog(1) && (eLog()<< Verbose(1) << "Could not add bond between " << atom1->Name << " and " << atom2->Name << " as one or both are not present in the molecule." << endl);
-  }
+
+  // some checks to make sure we are able to create the bond
+  ASSERT(atom1, "First atom in bond-creation was an invalid pointer");
+  ASSERT(atom2, "Second atom in bond-creation was an invalid pointer");
+  ASSERT(FindAtom(atom1->nr),"First atom in bond-creation was not part of molecule");
+  ASSERT(FindAtom(atom2->nr),"Second atom in bond-creation was not parto of molecule");
+
+  Binder = new bond(atom1, atom2, degree, BondCount++);
+  atom1->RegisterBond(Binder);
+  atom2->RegisterBond(Binder);
+  if ((atom1->type != NULL) && (atom1->type->Z != 1) && (atom2->type != NULL) && (atom2->type->Z != 1))
+    NoNonBonds++;
+
   return Binder;
 };
@@ -629,7 +682,5 @@
 {
   //DoeLog(1) && (eLog()<< Verbose(1) << "molecule::RemoveBond: Function not implemented yet." << endl);
-  pointer->leftatom->RegisterBond(pointer);
-  pointer->rightatom->RegisterBond(pointer);
-  removewithoutcheck(pointer);
+  delete(pointer);
   return true;
 };
@@ -691,13 +742,15 @@
 bool molecule::RemoveAtom(atom *pointer)
 {
+  ASSERT(pointer, "Null pointer passed to molecule::RemoveAtom().");
+  OBSERVE;
   if (ElementsInMolecule[pointer->type->Z] != 0)  { // this would indicate an error
     ElementsInMolecule[pointer->type->Z]--;  // decrease number of atom of this element
-    AtomCount--;
   } else
-    DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
+    DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->getName() << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
   if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
     ElementCount--;
   RemoveBonds(pointer);
-  return remove(pointer, start, end);
+  erase(pointer);
+  return true;
 };
 
@@ -713,8 +766,8 @@
     ElementsInMolecule[pointer->type->Z]--; // decrease number of atom of this element
   else
-    DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
+    DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->getName() << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
   if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
     ElementCount--;
-  unlink(pointer);
+  erase(pointer);
   return true;
 };
@@ -725,5 +778,6 @@
 bool molecule::CleanupMolecule()
 {
-  return (cleanup(first,last) && cleanup(start,end));
+  for (molecule::iterator iter = begin(); !empty(); iter = begin())
+      erase(iter);
 };
 
@@ -732,9 +786,13 @@
  * \return pointer to atom or NULL
  */
-atom * molecule::FindAtom(int Nr)  const{
-  atom * walker = find(&Nr, start,end);
-  if (walker != NULL) {
+atom * molecule::FindAtom(int Nr)  const
+{
+  molecule::const_iterator iter = begin();
+  for (; iter != end(); ++iter)
+    if ((*iter)->nr == Nr)
+      break;
+  if (iter != end()) {
     //Log() << Verbose(0) << "Found Atom Nr. " << walker->nr << endl;
-    return walker;
+    return (*iter);
   } else {
     DoLog(0) && (Log() << Verbose(0) << "Atom not found in list." << endl);
@@ -866,5 +924,5 @@
     now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
     for (int step=0;step<MDSteps;step++) {
-      *output << AtomCount << "\n\tCreated by molecuilder, step " << step << ", on " << ctime(&now);
+      *output << getAtomCount() << "\n\tCreated by molecuilder, step " << step << ", on " << ctime(&now);
       ActOnAllAtoms( &atom::OutputTrajectoryXYZ, output, step );
     }
@@ -883,5 +941,5 @@
   if (output != NULL) {
     now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
-    *output << AtomCount << "\n\tCreated by molecuilder on " << ctime(&now);
+    *output << getAtomCount() << "\n\tCreated by molecuilder on " << ctime(&now);
     ActOnAllAtoms( &atom::OutputXYZLine, output );
     return true;
@@ -893,35 +951,20 @@
  * \param *out output stream for debugging
  */
-void molecule::CountAtoms()
-{
+int molecule::doCountAtoms()
+{
+  int res = size();
   int i = 0;
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
+  NoNonHydrogen = 0;
+  for (molecule::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {
+    (*iter)->nr = i;   // update number in molecule (for easier referencing in FragmentMolecule lateron)
+    if ((*iter)->type->Z != 1) // count non-hydrogen atoms whilst at it
+      NoNonHydrogen++;
+    stringstream sstr;
+    sstr << (*iter)->type->symbol << (*iter)->nr+1;
+    (*iter)->setName(sstr.str());
+    DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << (*iter)->nr << " " << (*iter)->getName() << "." << endl);
     i++;
   }
-  if ((AtomCount == 0) || (i != AtomCount)) {
-    DoLog(3) && (Log() << Verbose(3) << "Mismatch in AtomCount " << AtomCount << " and recounted number " << i << ", renaming all." << endl);
-    AtomCount = i;
-
-    // count NonHydrogen atoms and give each atom a unique name
-    if (AtomCount != 0) {
-      i=0;
-      NoNonHydrogen = 0;
-      Walker = start;
-      while (Walker->next != end) {
-        Walker = Walker->next;
-        Walker->nr = i;   // update number in molecule (for easier referencing in FragmentMolecule lateron)
-        if (Walker->type->Z != 1) // count non-hydrogen atoms whilst at it
-          NoNonHydrogen++;
-        Free(&Walker->Name);
-        Walker->Name = Malloc<char>(6, "molecule::CountAtoms: *walker->Name");
-        sprintf(Walker->Name, "%2s%02d", Walker->type->symbol, Walker->nr+1);
-        DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << Walker->nr << " " << Walker->Name << "." << endl);
-        i++;
-      }
-    } else
-      DoLog(3) && (Log() << Verbose(3) << "AtomCount is still " << AtomCount << ", thus counting nothing." << endl);
-  }
+  return res;
 };
 
@@ -985,6 +1028,4 @@
   /// first count both their atoms and elements and update lists thereby ...
   //Log() << Verbose(0) << "Counting atoms, updating list" << endl;
-  CountAtoms();
-  OtherMolecule->CountAtoms();
   CountElements();
   OtherMolecule->CountElements();
@@ -993,8 +1034,8 @@
   /// -# AtomCount
   if (result) {
-    if (AtomCount != OtherMolecule->AtomCount) {
-      DoLog(4) && (Log() << Verbose(4) << "AtomCounts don't match: " << AtomCount << " == " << OtherMolecule->AtomCount << endl);
+    if (getAtomCount() != OtherMolecule->getAtomCount()) {
+      DoLog(4) && (Log() << Verbose(4) << "AtomCounts don't match: " << getAtomCount() << " == " << OtherMolecule->getAtomCount() << endl);
       result = false;
-    } else Log() << Verbose(4) << "AtomCounts match: " << AtomCount << " == " << OtherMolecule->AtomCount << endl;
+    } else Log() << Verbose(4) << "AtomCounts match: " << getAtomCount() << " == " << OtherMolecule->getAtomCount() << endl;
   }
   /// -# ElementCount
@@ -1033,18 +1074,28 @@
   if (result) {
     DoLog(5) && (Log() << Verbose(5) << "Calculating distances" << endl);
-    Distances = Calloc<double>(AtomCount, "molecule::IsEqualToWithinThreshold: Distances");
-    OtherDistances = Calloc<double>(AtomCount, "molecule::IsEqualToWithinThreshold: OtherDistances");
+    Distances = new double[getAtomCount()];
+    OtherDistances = new double[getAtomCount()];
     SetIndexedArrayForEachAtomTo ( Distances, &atom::nr, &atom::DistanceSquaredToVector, (const Vector &)CenterOfGravity);
     SetIndexedArrayForEachAtomTo ( OtherDistances, &atom::nr, &atom::DistanceSquaredToVector, (const Vector &)CenterOfGravity);
+    for(int i=0;i<getAtomCount();i++) {
+      Distances[i] = 0.;
+      OtherDistances[i] = 0.;
+    }
 
     /// ... sort each list (using heapsort (o(N log N)) from GSL)
     DoLog(5) && (Log() << Verbose(5) << "Sorting distances" << endl);
-    PermMap = Calloc<size_t>(AtomCount, "molecule::IsEqualToWithinThreshold: *PermMap");
-    OtherPermMap = Calloc<size_t>(AtomCount, "molecule::IsEqualToWithinThreshold: *OtherPermMap");
-    gsl_heapsort_index (PermMap, Distances, AtomCount, sizeof(double), CompareDoubles);
-    gsl_heapsort_index (OtherPermMap, OtherDistances, AtomCount, sizeof(double), CompareDoubles);
-    PermutationMap = Calloc<int>(AtomCount, "molecule::IsEqualToWithinThreshold: *PermutationMap");
+    PermMap = new size_t[getAtomCount()];
+    OtherPermMap = new size_t[getAtomCount()];
+    for(int i=0;i<getAtomCount();i++) {
+      PermMap[i] = 0;
+      OtherPermMap[i] = 0;
+    }
+    gsl_heapsort_index (PermMap, Distances, getAtomCount(), sizeof(double), CompareDoubles);
+    gsl_heapsort_index (OtherPermMap, OtherDistances, getAtomCount(), sizeof(double), CompareDoubles);
+    PermutationMap = new int[getAtomCount()];
+    for(int i=0;i<getAtomCount();i++)
+      PermutationMap[i] = 0;
     DoLog(5) && (Log() << Verbose(5) << "Combining Permutation Maps" << endl);
-    for(int i=AtomCount;i--;)
+    for(int i=getAtomCount();i--;)
       PermutationMap[PermMap[i]] = (int) OtherPermMap[i];
 
@@ -1052,5 +1103,5 @@
     DoLog(4) && (Log() << Verbose(4) << "Comparing distances" << endl);
     flag = 0;
-    for (int i=0;i<AtomCount;i++) {
+    for (int i=0;i<getAtomCount();i++) {
       DoLog(5) && (Log() << Verbose(5) << "Distances squared: |" << Distances[PermMap[i]] << " - " << OtherDistances[OtherPermMap[i]] << "| = " << fabs(Distances[PermMap[i]] - OtherDistances[OtherPermMap[i]]) << " ?<? " <<  threshold << endl);
       if (fabs(Distances[PermMap[i]] - OtherDistances[OtherPermMap[i]]) > threshold*threshold)
@@ -1059,10 +1110,10 @@
 
     // free memory
-    Free(&PermMap);
-    Free(&OtherPermMap);
-    Free(&Distances);
-    Free(&OtherDistances);
+    delete[](PermMap);
+    delete[](OtherPermMap);
+    delete[](Distances);
+    delete[](OtherDistances);
     if (flag) { // if not equal
-      Free(&PermutationMap);
+      delete[](PermutationMap);
       result = false;
     }
@@ -1088,32 +1139,27 @@
 int * molecule::GetFatherSonAtomicMap(molecule *OtherMolecule)
 {
-  atom *Walker = NULL, *OtherWalker = NULL;
   DoLog(3) && (Log() << Verbose(3) << "Begin of GetFatherAtomicMap." << endl);
-  int *AtomicMap = Malloc<int>(AtomCount, "molecule::GetAtomicMap: *AtomicMap");
-  for (int i=AtomCount;i--;)
+  int *AtomicMap = new int[getAtomCount()];
+  for (int i=getAtomCount();i--;)
     AtomicMap[i] = -1;
   if (OtherMolecule == this) {  // same molecule
-    for (int i=AtomCount;i--;) // no need as -1 means already that there is trivial correspondence
+    for (int i=getAtomCount();i--;) // no need as -1 means already that there is trivial correspondence
       AtomicMap[i] = i;
     DoLog(4) && (Log() << Verbose(4) << "Map is trivial." << endl);
   } else {
     DoLog(4) && (Log() << Verbose(4) << "Map is ");
-    Walker = start;
-    while (Walker->next != end) {
-      Walker = Walker->next;
-      if (Walker->father == NULL) {
-        AtomicMap[Walker->nr] = -2;
+    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+      if ((*iter)->father == NULL) {
+        AtomicMap[(*iter)->nr] = -2;
       } else {
-        OtherWalker = OtherMolecule->start;
-        while (OtherWalker->next != OtherMolecule->end) {
-          OtherWalker = OtherWalker->next;
+        for (molecule::const_iterator runner = OtherMolecule->begin(); runner != OtherMolecule->end(); ++runner) {
       //for (int i=0;i<AtomCount;i++) { // search atom
-        //for (int j=0;j<OtherMolecule->AtomCount;j++) {
-          //Log() << Verbose(4) << "Comparing father " << Walker->father << " with the other one " << OtherWalker->father << "." << endl;
-          if (Walker->father == OtherWalker)
-            AtomicMap[Walker->nr] = OtherWalker->nr;
+        //for (int j=0;j<OtherMolecule->getAtomCount();j++) {
+          //Log() << Verbose(4) << "Comparing father " << (*iter)->father << " with the other one " << (*runner)->father << "." << endl;
+          if ((*iter)->father == (*runner))
+            AtomicMap[(*iter)->nr] = (*runner)->nr;
         }
       }
-      DoLog(0) && (Log() << Verbose(0) << AtomicMap[Walker->nr] << "\t");
+      DoLog(0) && (Log() << Verbose(0) << AtomicMap[(*iter)->nr] << "\t");
     }
     DoLog(0) && (Log() << Verbose(0) << endl);
@@ -1149,8 +1195,6 @@
 void molecule::SetIndexedArrayForEachAtomTo ( atom **array, int ParticleInfo::*index) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    array[(Walker->*index)] = Walker;
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    array[((*iter)->*index)] = (*iter);
   }
 };
Index: src/molecule.hpp
===================================================================
--- src/molecule.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/molecule.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -34,4 +34,5 @@
 #include "tesselation.hpp"
 #include "Patterns/Observer.hpp"
+#include "Patterns/ObservedIterator.hpp"
 #include "Patterns/Cacheable.hpp"
 
@@ -90,12 +91,18 @@
   friend molecule *NewMolecule();
   friend void DeleteMolecule(molecule *);
+
   public:
+    typedef std::set<atom*> atomSet;
+    typedef ObservedIterator<atomSet> iterator;
+    typedef atomSet::const_iterator const_iterator;
+
     const periodentafel * const elemente; //!< periodic table with each element
-    atom *start;        //!< start of atom list
-    atom *end;          //!< end of atom list
-    bond *first;        //!< start of bond list
-    bond *last;         //!< end of bond list
+    // old deprecated atom handling
+    //atom *start;        //!< start of atom list
+    //atom *end;          //!< end of atom list
+    //bond *first;        //!< start of bond list
+    //bond *last;         //!< end of bond list
     int MDSteps;        //!< The number of MD steps in Trajectories
-    int AtomCount;          //!< number of atoms, brought up-to-date by CountAtoms()
+    //int AtomCount;          //!< number of atoms, brought up-to-date by CountAtoms()
     int BondCount;          //!< number of atoms, brought up-to-date by CountBonds()
     int ElementCount;       //!< how many unique elements are therein
@@ -112,6 +119,16 @@
   private:
     Cacheable<string> formula;
+    Cacheable<int>    AtomCount;
     moleculeId_t id;
+    atomSet atoms; //<!set of atoms
   protected:
+    //void CountAtoms();
+    /**
+     * this iterator type should be used for internal variables, \
+     * since it will not lock
+     */
+    typedef atomSet::iterator internal_iterator;
+
+
     molecule(const periodentafel * const teil);
     virtual ~molecule();
@@ -121,4 +138,6 @@
   //getter and setter
   const std::string getName();
+  int getAtomCount() const;
+  int doCountAtoms();
   moleculeId_t getId();
   void setId(moleculeId_t);
@@ -127,4 +146,15 @@
   std::string calcFormula();
 
+  iterator begin();
+  const_iterator begin() const;
+  iterator end();
+  const_iterator end() const;
+  bool empty() const;
+  size_t size() const;
+  const_iterator erase( const_iterator loc );
+  const_iterator erase( atom *& key );
+  const_iterator find (  atom *& key ) const;
+  pair<iterator,bool> insert ( atom * const key );
+
 
   // re-definition of virtual functions from PointCloud
@@ -132,10 +162,7 @@
   Vector *GetCenter() const ;
   TesselPoint *GetPoint() const ;
-  TesselPoint *GetTerminalPoint() const ;
   int GetMaxId() const;
   void GoToNext() const ;
-  void GoToPrevious() const ;
   void GoToFirst() const ;
-  void GoToLast() const ;
   bool IsEmpty() const ;
   bool IsEnd() const ;
@@ -226,4 +253,6 @@
   bool RemoveBond(bond *pointer);
   bool RemoveBonds(atom *BondPartner);
+  bool hasBondStructure();
+  unsigned int CountBonds() const;
 
   /// Find atoms.
@@ -232,5 +261,4 @@
 
   /// Count and change present atoms' coordination.
-  void CountAtoms();
   void CountElements();
   void CalculateOrbitals(class config &configuration);
@@ -249,4 +277,5 @@
   Vector * DetermineCenterOfGravity();
   Vector * DetermineCenterOfAll() const;
+  Vector * DetermineCenterOfBox() const;
   void SetNameFromFilename(const char *filename);
   void SetBoxDimension(Vector *dim);
@@ -301,4 +330,5 @@
   bool StoreForcesFile(MoleculeListClass *BondFragments, char *path, int *SortIndex);
   bool CreateMappingLabelsToConfigSequence(int *&SortIndex);
+  bool CreateFatherLookupTable(atom **&LookupTable, int count = 0);
   void BreadthFirstSearchAdd(molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem);
   /// -# BOSSANOVA
@@ -329,5 +359,5 @@
   private:
   int last_atom;      //!< number given to last atom
-  mutable atom *InternalPointer;  //!< internal pointer for PointCloud
+  mutable internal_iterator InternalPointer;  //!< internal pointer for PointCloud
 };
 
@@ -350,4 +380,5 @@
   bool StoreForcesFile(char *path, int *SortIndex);
   void insert(molecule *mol);
+  void erase(molecule *mol);
   molecule * ReturnIndex(int index);
   bool OutputConfigForListOfFragments(config *configuration, int *SortIndex);
Index: src/molecule_dynamics.cpp
===================================================================
--- src/molecule_dynamics.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/molecule_dynamics.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -10,4 +10,5 @@
 #include "config.hpp"
 #include "element.hpp"
+#include "info.hpp"
 #include "log.hpp"
 #include "memoryallocator.hpp"
@@ -28,12 +29,10 @@
   gsl_matrix *A = gsl_matrix_alloc(NDIM,NDIM);
   gsl_vector *x = gsl_vector_alloc(NDIM);
-  atom * Runner = mol->start;
   atom *Sprinter = NULL;
   Vector trajectory1, trajectory2, normal, TestVector;
   double Norm1, Norm2, tmp, result = 0.;
 
-  while (Runner->next != mol->end) {
-    Runner = Runner->next;
-    if (Runner == Walker) // hence, we only go up to the Walker, not beyond (similar to i=0; i<j; i++)
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    if ((*iter) == Walker) // hence, we only go up to the Walker, not beyond (similar to i=0; i<j; i++)
       break;
     // determine normalized trajectories direction vector (n1, n2)
@@ -42,19 +41,19 @@
     trajectory1.Normalize();
     Norm1 = trajectory1.Norm();
-    Sprinter = Params.PermutationMap[Runner->nr];   // find second target point
-    trajectory2 = Sprinter->Trajectory.R.at(Params.endstep) - Runner->Trajectory.R.at(Params.startstep);
+    Sprinter = Params.PermutationMap[(*iter)->nr];   // find second target point
+    trajectory2 = Sprinter->Trajectory.R.at(Params.endstep) - (*iter)->Trajectory.R.at(Params.startstep);
     trajectory2.Normalize();
     Norm2 = trajectory1.Norm();
     // check whether either is zero()
     if ((Norm1 < MYEPSILON) && (Norm2 < MYEPSILON)) {
-      tmp = Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.startstep));
+      tmp = Walker->Trajectory.R.at(Params.startstep).distance((*iter)->Trajectory.R.at(Params.startstep));
     } else if (Norm1 < MYEPSILON) {
       Sprinter = Params.PermutationMap[Walker->nr];   // find first target point
-      trajectory1 = Sprinter->Trajectory.R.at(Params.endstep) - Runner->Trajectory.R.at(Params.startstep);
+      trajectory1 = Sprinter->Trajectory.R.at(Params.endstep) - (*iter)->Trajectory.R.at(Params.startstep);
       trajectory2 *= trajectory1.ScalarProduct(trajectory2); // trajectory2 is scaled to unity, hence we don't need to divide by anything
       trajectory1 -= trajectory2;   // project the part in norm direction away
       tmp = trajectory1.Norm();  // remaining norm is distance
     } else if (Norm2 < MYEPSILON) {
-      Sprinter = Params.PermutationMap[Runner->nr];   // find second target point
+      Sprinter = Params.PermutationMap[(*iter)->nr];   // find second target point
       trajectory2 = Sprinter->Trajectory.R.at(Params.endstep) - Walker->Trajectory.R.at(Params.startstep);  // copy second offset
       trajectory1 *= trajectory2.ScalarProduct(trajectory1); // trajectory1 is scaled to unity, hence we don't need to divide by anything
@@ -66,8 +65,8 @@
   //        Log() << Verbose(0) << " and ";
   //        Log() << Verbose(0) << trajectory2;
-      tmp = Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.startstep));
+      tmp = Walker->Trajectory.R.at(Params.startstep).distance((*iter)->Trajectory.R.at(Params.startstep));
   //        Log() << Verbose(0) << " with distance " << tmp << "." << endl;
     } else { // determine distance by finding minimum distance
-  //        Log() << Verbose(3) << "Both trajectories of " << *Walker << " and " << *Runner << " are linear independent ";
+  //        Log() << Verbose(3) << "Both trajectories of " << *Walker << " and " << *(*iter) << " are linear independent ";
   //        Log() << Verbose(0) << endl;
   //        Log() << Verbose(0) << "First Trajectory: ";
@@ -85,5 +84,5 @@
         gsl_matrix_set(A, 1, i, trajectory2[i]);
         gsl_matrix_set(A, 2, i, normal[i]);
-        gsl_vector_set(x,i, (Walker->Trajectory.R.at(Params.startstep)[i] - Runner->Trajectory.R.at(Params.startstep)[i]));
+        gsl_vector_set(x,i, (Walker->Trajectory.R.at(Params.startstep)[i] - (*iter)->Trajectory.R.at(Params.startstep)[i]));
       }
       // solve the linear system by Householder transformations
@@ -96,5 +95,5 @@
       trajectory2.Scale(gsl_vector_get(x,1));
       normal.Scale(gsl_vector_get(x,2));
-      TestVector = Runner->Trajectory.R.at(Params.startstep) + trajectory2 + normal
+      TestVector = (*iter)->Trajectory.R.at(Params.startstep) + trajectory2 + normal
                    - (Walker->Trajectory.R.at(Params.startstep) + trajectory1);
       if (TestVector.Norm() < MYEPSILON) {
@@ -125,10 +124,8 @@
 {
   double result = 0.;
-  atom * Runner = mol->start;
-  while (Runner->next != mol->end) {
-    Runner = Runner->next;
-    if ((Params.PermutationMap[Walker->nr] == Params.PermutationMap[Runner->nr]) && (Walker->nr < Runner->nr)) {
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    if ((Params.PermutationMap[Walker->nr] == Params.PermutationMap[(*iter)->nr]) && (Walker->nr < (*iter)->nr)) {
   //    atom *Sprinter = PermutationMap[Walker->nr];
-  //        Log() << Verbose(0) << *Walker << " and " << *Runner << " are heading to the same target at ";
+  //        Log() << Verbose(0) << *Walker << " and " << *(*iter) << " are heading to the same target at ";
   //        Log() << Verbose(0) << Sprinter->Trajectory.R.at(endstep);
   //        Log() << Verbose(0) << ", penalting." << endl;
@@ -161,10 +158,8 @@
   // go through every atom
   atom *Runner = NULL;
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     // first term: distance to target
-    Runner = Params.PermutationMap[Walker->nr];   // find target point
-    tmp = (Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.endstep)));
+    Runner = Params.PermutationMap[(*iter)->nr];   // find target point
+    tmp = ((*iter)->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.endstep)));
     tmp *= Params.IsAngstroem ? 1. : 1./AtomicLengthToAngstroem;
     result += Params.PenaltyConstants[0] * tmp;
@@ -172,8 +167,8 @@
 
     // second term: sum of distances to other trajectories
-    result += SumDistanceOfTrajectories(Walker, this, Params);
+    result += SumDistanceOfTrajectories((*iter), this, Params);
 
     // third term: penalty for equal targets
-    result += PenalizeEqualTargets(Walker, this, Params);
+    result += PenalizeEqualTargets((*iter), this, Params);
   }
 
@@ -189,5 +184,7 @@
 {
   stringstream zeile1, zeile2;
-  int *DoubleList = Calloc<int>(AtomCount, "PrintPermutationMap: *DoubleList");
+  int *DoubleList = new int[AtomCount];
+  for(int i=0;i<AtomCount;i++)
+    DoubleList[i] = 0;
   int doubles = 0;
   zeile1 << "PermutationMap: ";
@@ -203,5 +200,5 @@
   if (doubles >0)
     DoLog(2) && (Log() << Verbose(2) << "Found " << doubles << " Doubles." << endl);
-  Free(&DoubleList);
+  delete[](DoubleList);
 //  Log() << Verbose(2) << zeile1.str() << endl << zeile2.str() << endl;
 };
@@ -213,17 +210,12 @@
 void FillDistanceList(molecule *mol, struct EvaluatePotential &Params)
 {
-  for (int i=mol->AtomCount; i--;) {
+  for (int i=mol->getAtomCount(); i--;) {
     Params.DistanceList[i] = new DistanceMap;    // is the distance sorted target list per atom
     Params.DistanceList[i]->clear();
   }
 
-  atom *Runner = NULL;
-  atom *Walker = mol->start;
-  while (Walker->next != mol->end) {
-    Walker = Walker->next;
-    Runner = mol->start;
-    while(Runner->next != mol->end) {
-      Runner = Runner->next;
-      Params.DistanceList[Walker->nr]->insert( DistancePair(Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.endstep)), Runner) );
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    for (molecule::const_iterator runner = mol->begin(); runner != mol->end(); ++runner) {
+      Params.DistanceList[(*iter)->nr]->insert( DistancePair((*iter)->Trajectory.R.at(Params.startstep).distance((*runner)->Trajectory.R.at(Params.endstep)), (*runner)) );
     }
   }
@@ -237,12 +229,10 @@
 void CreateInitialLists(molecule *mol, struct EvaluatePotential &Params)
 {
-  atom *Walker = mol->start;
-  while (Walker->next != mol->end) {
-    Walker = Walker->next;
-    Params.StepList[Walker->nr] = Params.DistanceList[Walker->nr]->begin();    // stores the step to the next iterator that could be a possible next target
-    Params.PermutationMap[Walker->nr] = Params.DistanceList[Walker->nr]->begin()->second;   // always pick target with the smallest distance
-    Params.DoubleList[Params.DistanceList[Walker->nr]->begin()->second->nr]++;            // increase this target's source count (>1? not injective)
-    Params.DistanceIterators[Walker->nr] = Params.DistanceList[Walker->nr]->begin();    // and remember which one we picked
-    DoLog(2) && (Log() << Verbose(2) << *Walker << " starts with distance " << Params.DistanceList[Walker->nr]->begin()->first << "." << endl);
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    Params.StepList[(*iter)->nr] = Params.DistanceList[(*iter)->nr]->begin();    // stores the step to the next iterator that could be a possible next target
+    Params.PermutationMap[(*iter)->nr] = Params.DistanceList[(*iter)->nr]->begin()->second;   // always pick target with the smallest distance
+    Params.DoubleList[Params.DistanceList[(*iter)->nr]->begin()->second->nr]++;            // increase this target's source count (>1? not injective)
+    Params.DistanceIterators[(*iter)->nr] = Params.DistanceList[(*iter)->nr]->begin();    // and remember which one we picked
+    DoLog(2) && (Log() << Verbose(2) << **iter << " starts with distance " << Params.DistanceList[(*iter)->nr]->begin()->first << "." << endl);
   }
 };
@@ -285,19 +275,23 @@
 void MakeInjectivePermutation(molecule *mol, struct EvaluatePotential &Params)
 {
-  atom *Walker = mol->start;
+  molecule::const_iterator iter = mol->begin();
   DistanceMap::iterator NewBase;
   double Potential = fabs(mol->ConstrainedPotential(Params));
 
+  if (mol->empty()) {
+    eLog() << Verbose(1) << "Molecule is empty." << endl;
+    return;
+  }
   while ((Potential) > Params.PenaltyConstants[2]) {
-    PrintPermutationMap(mol->AtomCount, Params);
-    Walker = Walker->next;
-    if (Walker == mol->end) // round-robin at the end
-      Walker = mol->start->next;
-    if (Params.DoubleList[Params.DistanceIterators[Walker->nr]->second->nr] <= 1)  // no need to make those injective that aren't
+    PrintPermutationMap(mol->getAtomCount(), Params);
+    iter++;
+    if (iter == mol->end()) // round-robin at the end
+      iter = mol->begin();
+    if (Params.DoubleList[Params.DistanceIterators[(*iter)->nr]->second->nr] <= 1)  // no need to make those injective that aren't
       continue;
     // now, try finding a new one
-    Potential = TryNextNearestNeighbourForInjectivePermutation(mol, Walker, Potential, Params);
-  }
-  for (int i=mol->AtomCount; i--;) // now each single entry in the DoubleList should be <=1
+    Potential = TryNextNearestNeighbourForInjectivePermutation(mol, (*iter), Potential, Params);
+  }
+  for (int i=mol->getAtomCount(); i--;) // now each single entry in the DoubleList should be <=1
     if (Params.DoubleList[i] > 1) {
       DoeLog(0) && (eLog()<< Verbose(0) << "Failed to create an injective PermutationMap!" << endl);
@@ -338,12 +332,18 @@
   double Potential, OldPotential, OlderPotential;
   struct EvaluatePotential Params;
-  Params.PermutationMap = Calloc<atom*>(AtomCount, "molecule::MinimiseConstrainedPotential: Params.**PermutationMap");
-  Params.DistanceList = Malloc<DistanceMap*>(AtomCount, "molecule::MinimiseConstrainedPotential: Params.**DistanceList");
-  Params.DistanceIterators = Malloc<DistanceMap::iterator>(AtomCount, "molecule::MinimiseConstrainedPotential: Params.*DistanceIterators");
-  Params.DoubleList = Calloc<int>(AtomCount, "molecule::MinimiseConstrainedPotential: Params.*DoubleList");
-  Params.StepList = Malloc<DistanceMap::iterator>(AtomCount, "molecule::MinimiseConstrainedPotential: Params.*StepList");
+  Params.PermutationMap = new atom *[getAtomCount()];
+  Params.DistanceList = new DistanceMap *[getAtomCount()];
+  Params.DistanceIterators = new DistanceMap::iterator[getAtomCount()];
+  Params.DoubleList = new int[getAtomCount()];
+  Params.StepList = new DistanceMap::iterator[getAtomCount()];
   int round;
-  atom *Walker = NULL, *Runner = NULL, *Sprinter = NULL;
+  atom *Sprinter = NULL;
   DistanceMap::iterator Rider, Strider;
+
+  // set to zero
+  for (int i=0;i<getAtomCount();i++) {
+    Params.PermutationMap[i] = NULL;
+    Params.DoubleList[i] = 0;
+  }
 
   /// Minimise the potential
@@ -362,5 +362,5 @@
   DoLog(1) && (Log() << Verbose(1) << "Making the PermutationMap injective ... " << endl);
   MakeInjectivePermutation(this, Params);
-  Free(&Params.DoubleList);
+  delete[](Params.DoubleList);
 
   // argument minimise the constrained potential in this injective PermutationMap
@@ -371,38 +371,37 @@
     DoLog(2) && (Log() << Verbose(2) << "Starting round " << ++round << ", at current potential " << OldPotential << " ... " << endl);
     OlderPotential = OldPotential;
+    molecule::const_iterator iter;
     do {
-      Walker = start;
-      while (Walker->next != end) { // pick one
-        Walker = Walker->next;
-        PrintPermutationMap(AtomCount, Params);
-        Sprinter = Params.DistanceIterators[Walker->nr]->second;   // store initial partner
-        Strider = Params.DistanceIterators[Walker->nr];  //remember old iterator
-        Params.DistanceIterators[Walker->nr] = Params.StepList[Walker->nr];
-        if (Params.DistanceIterators[Walker->nr] == Params.DistanceList[Walker->nr]->end()) {// stop, before we run through the list and still on
-          Params.DistanceIterators[Walker->nr] == Params.DistanceList[Walker->nr]->begin();
+      iter = begin();
+      for (; iter != end(); ++iter) {
+        PrintPermutationMap(getAtomCount(), Params);
+        Sprinter = Params.DistanceIterators[(*iter)->nr]->second;   // store initial partner
+        Strider = Params.DistanceIterators[(*iter)->nr];  //remember old iterator
+        Params.DistanceIterators[(*iter)->nr] = Params.StepList[(*iter)->nr];
+        if (Params.DistanceIterators[(*iter)->nr] == Params.DistanceList[(*iter)->nr]->end()) {// stop, before we run through the list and still on
+          Params.DistanceIterators[(*iter)->nr] == Params.DistanceList[(*iter)->nr]->begin();
           break;
         }
-        //Log() << Verbose(2) << "Current Walker: " << *Walker << " with old/next candidate " << *Sprinter << "/" << *DistanceIterators[Walker->nr]->second << "." << endl;
+        //Log() << Verbose(2) << "Current Walker: " << *(*iter) << " with old/next candidate " << *Sprinter << "/" << *DistanceIterators[(*iter)->nr]->second << "." << endl;
         // find source of the new target
-        Runner = start->next;
-        while(Runner != end) { // find the source whose toes we might be stepping on (Walker's new target should be in use by another already)
-          if (Params.PermutationMap[Runner->nr] == Params.DistanceIterators[Walker->nr]->second) {
-            //Log() << Verbose(2) << "Found the corresponding owner " << *Runner << " to " << *PermutationMap[Runner->nr] << "." << endl;
+        molecule::const_iterator runner = begin();
+        for (; runner != end(); ++runner) { // find the source whose toes we might be stepping on (Walker's new target should be in use by another already)
+          if (Params.PermutationMap[(*runner)->nr] == Params.DistanceIterators[(*iter)->nr]->second) {
+            //Log() << Verbose(2) << "Found the corresponding owner " << *(*runner) << " to " << *PermutationMap[(*runner)->nr] << "." << endl;
             break;
           }
-          Runner = Runner->next;
         }
-        if (Runner != end) { // we found the other source
+        if (runner != end()) { // we found the other source
           // then look in its distance list for Sprinter
-          Rider = Params.DistanceList[Runner->nr]->begin();
-          for (; Rider != Params.DistanceList[Runner->nr]->end(); Rider++)
+          Rider = Params.DistanceList[(*runner)->nr]->begin();
+          for (; Rider != Params.DistanceList[(*runner)->nr]->end(); Rider++)
             if (Rider->second == Sprinter)
               break;
-          if (Rider != Params.DistanceList[Runner->nr]->end()) { // if we have found one
-            //Log() << Verbose(2) << "Current Other: " << *Runner << " with old/next candidate " << *PermutationMap[Runner->nr] << "/" << *Rider->second << "." << endl;
+          if (Rider != Params.DistanceList[(*runner)->nr]->end()) { // if we have found one
+            //Log() << Verbose(2) << "Current Other: " << *(*runner) << " with old/next candidate " << *PermutationMap[(*runner)->nr] << "/" << *Rider->second << "." << endl;
             // exchange both
-            Params.PermutationMap[Walker->nr] = Params.DistanceIterators[Walker->nr]->second; // put next farther distance into PermutationMap
-            Params.PermutationMap[Runner->nr] = Sprinter;  // and hand the old target to its respective owner
-            PrintPermutationMap(AtomCount, Params);
+            Params.PermutationMap[(*iter)->nr] = Params.DistanceIterators[(*iter)->nr]->second; // put next farther distance into PermutationMap
+            Params.PermutationMap[(*runner)->nr] = Sprinter;  // and hand the old target to its respective owner
+            PrintPermutationMap(getAtomCount(), Params);
             // calculate the new potential
             //Log() << Verbose(2) << "Checking new potential ..." << endl;
@@ -410,13 +409,13 @@
             if (Potential > OldPotential) { // we made everything worse! Undo ...
               //Log() << Verbose(3) << "Nay, made the potential worse: " << Potential << " vs. " << OldPotential << "!" << endl;
-              //Log() << Verbose(3) << "Setting " << *Runner << "'s source to " << *Params.DistanceIterators[Runner->nr]->second << "." << endl;
+              //Log() << Verbose(3) << "Setting " << *(*runner) << "'s source to " << *Params.DistanceIterators[(*runner)->nr]->second << "." << endl;
               // Undo for Runner (note, we haven't moved the iteration yet, we may use this)
-              Params.PermutationMap[Runner->nr] = Params.DistanceIterators[Runner->nr]->second;
+              Params.PermutationMap[(*runner)->nr] = Params.DistanceIterators[(*runner)->nr]->second;
               // Undo for Walker
-              Params.DistanceIterators[Walker->nr] = Strider;  // take next farther distance target
-              //Log() << Verbose(3) << "Setting " << *Walker << "'s source to " << *Params.DistanceIterators[Walker->nr]->second << "." << endl;
-              Params.PermutationMap[Walker->nr] = Params.DistanceIterators[Walker->nr]->second;
+              Params.DistanceIterators[(*iter)->nr] = Strider;  // take next farther distance target
+              //Log() << Verbose(3) << "Setting " << *(*iter) << "'s source to " << *Params.DistanceIterators[(*iter)->nr]->second << "." << endl;
+              Params.PermutationMap[(*iter)->nr] = Params.DistanceIterators[(*iter)->nr]->second;
             } else {
-              Params.DistanceIterators[Runner->nr] = Rider;  // if successful also move the pointer in the iterator list
+              Params.DistanceIterators[(*runner)->nr] = Rider;  // if successful also move the pointer in the iterator list
               DoLog(3) && (Log() << Verbose(3) << "Found a better permutation, new potential is " << Potential << " vs." << OldPotential << "." << endl);
               OldPotential = Potential;
@@ -428,13 +427,13 @@
             //Log() << Verbose(0) << endl;
           } else {
-            DoeLog(1) && (eLog()<< Verbose(1) << *Runner << " was not the owner of " << *Sprinter << "!" << endl);
+            DoeLog(1) && (eLog()<< Verbose(1) << **runner << " was not the owner of " << *Sprinter << "!" << endl);
             exit(255);
           }
         } else {
-          Params.PermutationMap[Walker->nr] = Params.DistanceIterators[Walker->nr]->second; // new target has no source!
+          Params.PermutationMap[(*iter)->nr] = Params.DistanceIterators[(*iter)->nr]->second; // new target has no source!
         }
-        Params.StepList[Walker->nr]++; // take next farther distance target
+        Params.StepList[(*iter)->nr]++; // take next farther distance target
       }
-    } while (Walker->next != end);
+    } while (++iter != end());
   } while ((OlderPotential - OldPotential) > 1e-3);
   DoLog(1) && (Log() << Verbose(1) << "done." << endl);
@@ -442,8 +441,8 @@
 
   /// free memory and return with evaluated potential
-  for (int i=AtomCount; i--;)
+  for (int i=getAtomCount(); i--;)
     Params.DistanceList[i]->clear();
-  Free(&Params.DistanceList);
-  Free(&Params.DistanceIterators);
+  delete[](Params.DistanceList);
+  delete[](Params.DistanceIterators);
   return ConstrainedPotential(Params);
 };
@@ -483,9 +482,9 @@
   // Get the Permutation Map by MinimiseConstrainedPotential
   atom **PermutationMap = NULL;
-  atom *Walker = NULL, *Sprinter = NULL;
+  atom *Sprinter = NULL;
   if (!MapByIdentity)
     MinimiseConstrainedPotential(PermutationMap, startstep, endstep, configuration.GetIsAngstroem());
   else {
-    PermutationMap = Malloc<atom *>(AtomCount, "molecule::LinearInterpolationBetweenConfiguration: **PermutationMap");
+    PermutationMap = new atom *[getAtomCount()];
     SetIndexedArrayForEachAtomTo( PermutationMap, &atom::nr );
   }
@@ -502,17 +501,15 @@
     mol = World::getInstance().createMolecule();
     MoleculePerStep->insert(mol);
-    Walker = start;
-    while (Walker->next != end) {
-      Walker = Walker->next;
+    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
       // add to molecule list
-      Sprinter = mol->AddCopyAtom(Walker);
+      Sprinter = mol->AddCopyAtom((*iter));
       for (int n=NDIM;n--;) {
-        Sprinter->x[n] = Walker->Trajectory.R.at(startstep)[n] + (PermutationMap[Walker->nr]->Trajectory.R.at(endstep)[n] - Walker->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps);
+        Sprinter->x[n] = (*iter)->Trajectory.R.at(startstep)[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep)[n] - (*iter)->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps);
         // add to Trajectories
         //Log() << Verbose(3) << step << ">=" << MDSteps-1 << endl;
         if (step < MaxSteps) {
-          Walker->Trajectory.R.at(step)[n] = Walker->Trajectory.R.at(startstep)[n] + (PermutationMap[Walker->nr]->Trajectory.R.at(endstep)[n] - Walker->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps);
-          Walker->Trajectory.U.at(step)[n] = 0.;
-          Walker->Trajectory.F.at(step)[n] = 0.;
+          (*iter)->Trajectory.R.at(step)[n] = (*iter)->Trajectory.R.at(startstep)[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep)[n] - (*iter)->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps);
+          (*iter)->Trajectory.U.at(step)[n] = 0.;
+          (*iter)->Trajectory.F.at(step)[n] = 0.;
         }
       }
@@ -522,11 +519,12 @@
 
   // store the list to single step files
-  int *SortIndex = Malloc<int>(AtomCount, "molecule::LinearInterpolationBetweenConfiguration: *SortIndex");
-  for (int i=AtomCount; i--; )
+  int *SortIndex = new int[getAtomCount()];
+  for (int i=getAtomCount(); i--; )
     SortIndex[i] = i;
   status = MoleculePerStep->OutputConfigForListOfFragments(&configuration, SortIndex);
+  delete[](SortIndex);
 
   // free and return
-  Free(&PermutationMap);
+  delete[](PermutationMap);
   delete(MoleculePerStep);
   return status;
@@ -548,4 +546,5 @@
 bool molecule::VerletForceIntegration(char *file, config &configuration)
 {
+  Info FunctionInfo(__func__);
   ifstream input(file);
   string token;
@@ -567,6 +566,6 @@
       return false;
     }
-    if (Force.RowCounter[0] != AtomCount) {
-      DoeLog(0) && (eLog()<< Verbose(0) << "Mismatch between number of atoms in file " << Force.RowCounter[0] << " and in molecule " << AtomCount << "." << endl);
+    if (Force.RowCounter[0] != getAtomCount()) {
+      DoeLog(0) && (eLog()<< Verbose(0) << "Mismatch between number of atoms in file " << Force.RowCounter[0] << " and in molecule " << getAtomCount() << "." << endl);
       performCriticalExit();
       return false;
@@ -574,11 +573,11 @@
     // correct Forces
     Velocity.Zero();
-    for(int i=0;i<AtomCount;i++)
+    for(int i=0;i<getAtomCount();i++)
       for(int d=0;d<NDIM;d++) {
         Velocity[d] += Force.Matrix[0][i][d+5];
       }
-    for(int i=0;i<AtomCount;i++)
+    for(int i=0;i<getAtomCount();i++)
       for(int d=0;d<NDIM;d++) {
-        Force.Matrix[0][i][d+5] -= Velocity[d]/(double)AtomCount;
+        Force.Matrix[0][i][d+5] -= Velocity[d]/static_cast<double>(getAtomCount());
       }
     // solve a constrained potential if we are meant to
@@ -588,22 +587,22 @@
       ConstrainedPotentialEnergy = MinimiseConstrainedPotential(PermutationMap,configuration.DoConstrainedMD, 0, configuration.GetIsAngstroem());
       EvaluateConstrainedForces(configuration.DoConstrainedMD, 0, PermutationMap, &Force);
-      Free(&PermutationMap);
+      delete[](PermutationMap);
     }
 
     // and perform Verlet integration for each atom with position, velocity and force vector
     // check size of vectors
-    ActOnAllAtoms( &atom::ResizeTrajectory, MDSteps+10 );
-
-    ActOnAllAtoms( &atom::VelocityVerletUpdate, MDSteps, &configuration, &Force);
+    //ActOnAllAtoms( &atom::ResizeTrajectory, MDSteps+10 );
+
+    ActOnAllAtoms( &atom::VelocityVerletUpdate, MDSteps+1, &configuration, &Force);
   }
   // correct velocities (rather momenta) so that center of mass remains motionless
   Velocity.Zero();
   IonMass = 0.;
-  ActOnAllAtoms ( &atom::SumUpKineticEnergy, MDSteps, &IonMass, &Velocity );
+  ActOnAllAtoms ( &atom::SumUpKineticEnergy, MDSteps+1, &IonMass, &Velocity );
 
   // correct velocities (rather momenta) so that center of mass remains motionless
   Velocity.Scale(1./IonMass);
   ActualTemp = 0.;
-  ActOnAllAtoms ( &atom::CorrectVelocity, &ActualTemp, MDSteps, &Velocity );
+  ActOnAllAtoms ( &atom::CorrectVelocity, &ActualTemp, MDSteps+1, &Velocity );
   Thermostats(configuration, ActualTemp, Berendsen);
   MDSteps++;
@@ -683,5 +682,5 @@
       delta_alpha = 0.;
       ActOnAllAtoms( &atom::Thermostat_NoseHoover_init, MDSteps, &delta_alpha );
-      delta_alpha = (delta_alpha - (3.*AtomCount+1.) * configuration.TargetTemp)/(configuration.HooverMass*Units2Electronmass);
+      delta_alpha = (delta_alpha - (3.*getAtomCount()+1.) * configuration.TargetTemp)/(configuration.HooverMass*Units2Electronmass);
       configuration.alpha += delta_alpha*configuration.Deltat;
       DoLog(3) && (Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << configuration.Deltat << " = " << configuration.alpha << "." << endl);
Index: src/molecule_fragmentation.cpp
===================================================================
--- src/molecule_fragmentation.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/molecule_fragmentation.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -39,8 +39,6 @@
   int FragmentCount;
   // get maximum bond degree
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    c = (Walker->ListOfBonds.size() > c) ? Walker->ListOfBonds.size() : c;
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    c = ((*iter)->ListOfBonds.size() > c) ? (*iter)->ListOfBonds.size() : c;
   }
   FragmentCount = NoNonHydrogen*(1 << (c*order));
@@ -94,5 +92,5 @@
   GraphTestPair testGraphInsert;
   int NumberOfFragments = 0;
-  char *filename = Malloc<char>(MAXSTRINGSIZE, "molecule::ParseKeySetFile - filename");
+  char filename[MAXSTRINGSIZE];
 
   if (FragmentList == NULL) { // check list pointer
@@ -106,5 +104,5 @@
   if (InputFile != NULL) {
     // each line represents a new fragment
-    char *buffer = Malloc<char>(MAXSTRINGSIZE, "molecule::ParseKeySetFile - *buffer");
+    char buffer[MAXSTRINGSIZE];
     // 1. parse keysets and insert into temp. graph
     while (!InputFile.eof()) {
@@ -122,12 +120,10 @@
     InputFile.close();
     InputFile.clear();
-    Free(&buffer);
-    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "\t ... done." << endl);
   } else {
-    DoLog(1) && (Log() << Verbose(1) << "File " << filename << " not found." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "\t ... File " << filename << " not found." << endl);
     status = false;
   }
 
-  Free(&filename);
   return status;
 };
@@ -148,5 +144,5 @@
   int NumberOfFragments = 0;
   double TEFactor;
-  char *filename = Malloc<char>(MAXSTRINGSIZE, "molecule::ParseTEFactorsFile - filename");
+  char filename[MAXSTRINGSIZE];
 
   if (FragmentList == NULL) { // check list pointer
@@ -179,7 +175,4 @@
   }
 
-  // free memory
-  Free(&filename);
-
   return status;
 };
@@ -317,5 +310,5 @@
   int No = 0, FragOrder = 0;
   double Value = 0.;
-  char *buffer = Malloc<char>(MAXSTRINGSIZE, "molecule::CheckOrderAtSite: *buffer");
+  char buffer[MAXSTRINGSIZE];
   sprintf(buffer, "%s/%s%s.dat", path, FRAGMENTPREFIX, ENERGYPERFRAGMENT);
   ifstream InputFile(buffer, ios::in);
@@ -345,5 +338,4 @@
     InputFile.clear();
   }
-  Free(&buffer);
 
   return AdaptiveCriteriaList;
@@ -359,5 +351,5 @@
 map<double, pair<int,int> >  * ReMapAdaptiveCriteriaListToValue(map<int, pair<double,int> > *AdaptiveCriteriaList, molecule *mol)
 {
-  atom *Walker = mol->start;
+  atom *Walker = NULL;
   map<double, pair<int,int> > *FinalRootCandidates = new map<double, pair<int,int> > ;
   DoLog(1) && (Log() << Verbose(1) << "Root candidate list is: " << endl);
@@ -391,5 +383,5 @@
 bool MarkUpdateCandidates(bool *AtomMask, map<double, pair<int,int> > &FinalRootCandidates, int Order, molecule *mol)
 {
-  atom *Walker = mol->start;
+  atom *Walker = NULL;
   int No = -1;
   bool status = false;
@@ -435,13 +427,12 @@
 bool molecule::CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path)
 {
-  atom *Walker = start;
   bool status = false;
 
   // initialize mask list
-  for(int i=AtomCount;i--;)
+  for(int i=getAtomCount();i--;)
     AtomMask[i] = false;
 
   if (Order < 0) { // adaptive increase of BondOrder per site
-    if (AtomMask[AtomCount] == true)  // break after one step
+    if (AtomMask[getAtomCount()] == true)  // break after one step
       return false;
 
@@ -457,11 +448,10 @@
     if (AdaptiveCriteriaList->empty()) {
       DoeLog(2) && (eLog()<< Verbose(2) << "Unable to parse file, incrementing all." << endl);
-      while (Walker->next != end) {
-        Walker = Walker->next;
+      for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     #ifdef ADDHYDROGEN
-        if (Walker->type->Z != 1) // skip hydrogen
+        if ((*iter)->type->Z != 1) // skip hydrogen
     #endif
         {
-          AtomMask[Walker->nr] = true;  // include all (non-hydrogen) atoms
+          AtomMask[(*iter)->nr] = true;  // include all (non-hydrogen) atoms
           status = true;
         }
@@ -474,20 +464,19 @@
     MarkUpdateCandidates(AtomMask, *FinalRootCandidates, Order, this);
 
-    Free(&IndexKeySetList);
-    Free(&AdaptiveCriteriaList);
-    Free(&FinalRootCandidates);
+    delete[](IndexKeySetList);
+    delete[](AdaptiveCriteriaList);
+    delete[](FinalRootCandidates);
   } else { // global increase of Bond Order
-    while (Walker->next != end) {
-      Walker = Walker->next;
+    for(molecule::const_iterator iter = begin(); iter != end(); ++iter) {
   #ifdef ADDHYDROGEN
-      if (Walker->type->Z != 1) // skip hydrogen
+      if ((*iter)->type->Z != 1) // skip hydrogen
   #endif
       {
-        AtomMask[Walker->nr] = true;  // include all (non-hydrogen) atoms
-        if ((Order != 0) && (Walker->AdaptiveOrder < Order)) // && (Walker->AdaptiveOrder < MinimumRingSize[Walker->nr]))
+        AtomMask[(*iter)->nr] = true;  // include all (non-hydrogen) atoms
+        if ((Order != 0) && ((*iter)->AdaptiveOrder < Order)) // && ((*iter)->AdaptiveOrder < MinimumRingSize[(*iter)->nr]))
           status = true;
       }
     }
-    if ((Order == 0) && (AtomMask[AtomCount] == false))  // single stepping, just check
+    if ((!Order) && (!AtomMask[getAtomCount()]))  // single stepping, just check
       status = true;
 
@@ -500,5 +489,5 @@
   }
 
-  PrintAtomMask(AtomMask, AtomCount); // for debugging
+  PrintAtomMask(AtomMask, getAtomCount()); // for debugging
 
   return status;
@@ -516,6 +505,6 @@
     return false;
   }
-  SortIndex = Malloc<int>(AtomCount, "molecule::CreateMappingLabelsToConfigSequence: *SortIndex");
-  for(int i=AtomCount;i--;)
+  SortIndex = new int[getAtomCount()];
+  for(int i=getAtomCount();i--;)
     SortIndex[i] = -1;
 
@@ -524,4 +513,59 @@
 
   return true;
+};
+
+
+
+/** Creates a lookup table for true father's Atom::Nr -> atom ptr.
+ * \param *start begin of list (STL iterator, i.e. first item)
+ * \paran *end end of list (STL iterator, i.e. one past last item)
+ * \param **Lookuptable pointer to return allocated lookup table (should be NULL on start)
+ * \param count optional predetermined size for table (otherwise we set the count to highest true father id)
+ * \return true - success, false - failure
+ */
+bool molecule::CreateFatherLookupTable(atom **&LookupTable, int count)
+{
+  bool status = true;
+  int AtomNo;
+
+  if (LookupTable != NULL) {
+    Log() << Verbose(0) << "Pointer for Lookup table is not NULL! Aborting ..." <<endl;
+    return false;
+  }
+
+  // count them
+  if (count == 0) {
+    for (molecule::iterator iter = begin(); iter != end(); ++iter) { // create a lookup table (Atom::nr -> atom) used as a marker table lateron
+      count = (count < (*iter)->GetTrueFather()->nr) ? (*iter)->GetTrueFather()->nr : count;
+    }
+  }
+  if (count <= 0) {
+    Log() << Verbose(0) << "Count of lookup list is 0 or less." << endl;
+    return false;
+  }
+
+  // allocate and fill
+  LookupTable = new atom *[count];
+  if (LookupTable == NULL) {
+    eLog() << Verbose(0) << "LookupTable memory allocation failed!" << endl;
+    performCriticalExit();
+    status = false;
+  } else {
+    for (int i=0;i<count;i++)
+      LookupTable[i] = NULL;
+    for (molecule::iterator iter = begin(); iter != end(); ++iter) {
+      AtomNo = (*iter)->GetTrueFather()->nr;
+      if ((AtomNo >= 0) && (AtomNo < count)) {
+        //*out << "Setting LookupTable[" << AtomNo << "] to " << *(*iter) << endl;
+        LookupTable[AtomNo] = (*iter);
+      } else {
+        Log() << Verbose(0) << "Walker " << *(*iter) << " exceeded range of nuclear ids [0, " << count << ")." << endl;
+        status = false;
+        break;
+      }
+    }
+  }
+
+  return status;
 };
 
@@ -547,6 +591,5 @@
 {
   MoleculeListClass *BondFragments = NULL;
-  int *SortIndex = NULL;
-  int *MinimumRingSize = new int[AtomCount];
+  int *MinimumRingSize = new int[getAtomCount()];
   int FragmentCounter;
   MoleculeLeafClass *MolecularWalker = NULL;
@@ -576,9 +619,9 @@
 
   // create lookup table for Atom::nr
-  FragmentationToDo = FragmentationToDo && CreateFatherLookupTable(start, end, ListOfAtoms, AtomCount);
+  FragmentationToDo = FragmentationToDo && CreateFatherLookupTable(ListOfAtoms, getAtomCount());
 
   // === compare it with adjacency file ===
   FragmentationToDo = FragmentationToDo && CheckAdjacencyFileAgainstMolecule(configuration->configpath, ListOfAtoms);
-  Free(&ListOfAtoms);
+  delete[](ListOfAtoms);
 
   // ===== 2. perform a DFS analysis to gather info on cyclic structure and a list of disconnected subgraphs =====
@@ -586,6 +629,6 @@
 
   // analysis of the cycles (print rings, get minimum cycle length) for each subgraph
-  for(int i=AtomCount;i--;)
-    MinimumRingSize[i] = AtomCount;
+  for(int i=getAtomCount();i--;)
+    MinimumRingSize[i] = getAtomCount();
   MolecularWalker = Subgraphs;
   FragmentCounter = 0;
@@ -593,10 +636,10 @@
     MolecularWalker = MolecularWalker->next;
     // fill the bond structure of the individually stored subgraphs
-  MolecularWalker->FillBondStructureFromReference(this, FragmentCounter, ListOfLocalAtoms, false);  // we want to keep the created ListOfLocalAtoms
+    MolecularWalker->FillBondStructureFromReference(this, FragmentCounter, ListOfLocalAtoms, false);  // we want to keep the created ListOfLocalAtoms
     DoLog(0) && (Log() << Verbose(0) << "Analysing the cycles of subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl);
     LocalBackEdgeStack = new StackClass<bond *> (MolecularWalker->Leaf->BondCount);
 //    // check the list of local atoms for debugging
 //    Log() << Verbose(0) << "ListOfLocalAtoms for this subgraph is:" << endl;
-//    for (int i=0;i<AtomCount;i++)
+//    for (int i=0;i<getAtomCount();i++)
 //      if (ListOfLocalAtoms[FragmentCounter][i] == NULL)
 //        Log() << Verbose(0) << "\tNULL";
@@ -624,10 +667,10 @@
   // ===== 6b. prepare and go into the adaptive (Order<0), single-step (Order==0) or incremental (Order>0) cycle
   KeyStack *RootStack = new KeyStack[Subgraphs->next->Count()];
-  AtomMask = new bool[AtomCount+1];
-  AtomMask[AtomCount] = false;
+  AtomMask = new bool[getAtomCount()+1];
+  AtomMask[getAtomCount()] = false;
   FragmentationToDo = false;  // if CheckOrderAtSite just ones recommends fragmentation, we will save fragments afterwards
   while ((CheckOrder = CheckOrderAtSite(AtomMask, ParsedFragmentList, Order, MinimumRingSize, configuration->configpath))) {
     FragmentationToDo = FragmentationToDo || CheckOrder;
-    AtomMask[AtomCount] = true;   // last plus one entry is used as marker that we have been through this loop once already in CheckOrderAtSite()
+    AtomMask[getAtomCount()] = true;   // last plus one entry is used as marker that we have been through this loop once already in CheckOrderAtSite()
     // ===== 6b. fill RootStack for each subgraph (second adaptivity check) =====
     Subgraphs->next->FillRootStackForSubgraphs(RootStack, AtomMask, (FragmentCounter = 0));
@@ -640,5 +683,5 @@
       DoLog(1) && (Log() << Verbose(1) << "Fragmenting subgraph " << MolecularWalker << "." << endl);
       //MolecularWalker->Leaf->OutputListOfBonds(out);  // output atom::ListOfBonds for debugging
-      if (MolecularWalker->Leaf->first->next != MolecularWalker->Leaf->last) {
+      if (MolecularWalker->Leaf->hasBondStructure()) {
         // call BOSSANOVA method
         DoLog(0) && (Log() << Verbose(0) << endl << " ========== BOND ENERGY of subgraph " << FragmentCounter << " ========================= " << endl);
@@ -672,5 +715,5 @@
     delete(Subgraphs);
   }
-  Free(&FragmentList);
+  delete[](FragmentList);
 
   // ===== 8b. gather keyset lists (graphs) from all subgraphs and transform into MoleculeListClass =====
@@ -690,4 +733,5 @@
   if (BondFragments->ListOfMolecules.size() != 0) {
     // create the SortIndex from BFS labels to order in the config file
+    int *SortIndex = NULL;
     CreateMappingLabelsToConfigSequence(SortIndex);
 
@@ -704,10 +748,11 @@
     StoreKeySetFile(TotalGraph, configuration->configpath);
 
-    // store Adjacency file
-    char *filename = Malloc<char> (MAXSTRINGSIZE, "molecule::FragmentMolecule - *filename");
-    strcpy(filename, FRAGMENTPREFIX);
-    strcat(filename, ADJACENCYFILE);
-    StoreAdjacencyToFile(configuration->configpath, filename);
-    Free(&filename);
+    {
+      // store Adjacency file
+      char filename[MAXSTRINGSIZE];
+      strcpy(filename, FRAGMENTPREFIX);
+      strcat(filename, ADJACENCYFILE);
+      StoreAdjacencyToFile(configuration->configpath, filename);
+    }
 
     // store Hydrogen saturation correction file
@@ -722,6 +767,5 @@
     // free memory for bond part
     DoLog(1) && (Log() << Verbose(1) << "Freeing bond memory" << endl);
-    delete(FragmentList); // remove bond molecule from memory
-    Free(&SortIndex);
+    delete[](SortIndex);
   } else {
     DoLog(1) && (Log() << Verbose(1) << "FragmentList is zero on return, splitting failed." << endl);
@@ -768,10 +812,15 @@
 bool molecule::ParseOrderAtSiteFromFile(char *path)
 {
-  unsigned char *OrderArray = Calloc<unsigned char>(AtomCount, "molecule::ParseOrderAtSiteFromFile - *OrderArray");
-  bool *MaxArray = Calloc<bool>(AtomCount, "molecule::ParseOrderAtSiteFromFile - *MaxArray");
+  unsigned char *OrderArray = new unsigned char[getAtomCount()];
+  bool *MaxArray = new bool[getAtomCount()];
   bool status;
   int AtomNr, value;
   stringstream line;
   ifstream file;
+
+  for(int i=0;i<getAtomCount();i++) {
+    OrderArray[i] = 0;
+    MaxArray[i] = false;
+  }
 
   DoLog(1) && (Log() << Verbose(1) << "Begin of ParseOrderAtSiteFromFile" << endl);
@@ -796,12 +845,12 @@
     SetAtomValueToIndexedArray( MaxArray, &atom::nr, &atom::MaxOrder );
 
-    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "\t ... done." << endl);
     status = true;
   } else {
-    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "\t ... failed to open file " << line.str() << "." << endl);
     status = false;
   }
-  Free(&OrderArray);
-  Free(&MaxArray);
+  delete[](OrderArray);
+  delete[](MaxArray);
 
   DoLog(1) && (Log() << Verbose(1) << "End of ParseOrderAtSiteFromFile" << endl);
@@ -872,11 +921,13 @@
   atom *OtherFather = NULL;
   atom *FatherOfRunner = NULL;
-  Leaf->CountAtoms();
-
-  atom *Runner = Leaf->start;
-  while (Runner->next != Leaf->end) {
-    Runner = Runner->next;
+
+#ifdef ADDHYDROGEN
+  molecule::const_iterator runner;
+#endif
+  // we increment the iter just before skipping the hydrogen
+  for (molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end();) {
     LonelyFlag = true;
-    FatherOfRunner = Runner->father;
+    FatherOfRunner = (*iter)->father;
+    ASSERT(FatherOfRunner,"Atom without father found");
     if (SonList[FatherOfRunner->nr] != NULL)  {  // check if this, our father, is present in list
       // create all bonds
@@ -889,7 +940,7 @@
 //            Log() << Verbose(3) << "Adding Bond: ";
 //            Log() << Verbose(0) <<
-            Leaf->AddBond(Runner, SonList[OtherFather->nr], (*BondRunner)->BondDegree);
+            Leaf->AddBond((*iter), SonList[OtherFather->nr], (*BondRunner)->BondDegree);
 //            Log() << Verbose(0) << "." << endl;
-            //NumBonds[Runner->nr]++;
+            //NumBonds[(*iter)->nr]++;
           } else {
 //            Log() << Verbose(3) << "Not adding bond, labels in wrong order." << endl;
@@ -899,20 +950,22 @@
 //          Log() << Verbose(0) << ", who has no son in this fragment molecule." << endl;
 #ifdef ADDHYDROGEN
-          //Log() << Verbose(3) << "Adding Hydrogen to " << Runner->Name << " and a bond in between." << endl;
-          if(!Leaf->AddHydrogenReplacementAtom((*BondRunner), Runner, FatherOfRunner, OtherFather, IsAngstroem))
+          //Log() << Verbose(3) << "Adding Hydrogen to " << (*iter)->Name << " and a bond in between." << endl;
+          if(!Leaf->AddHydrogenReplacementAtom((*BondRunner), (*iter), FatherOfRunner, OtherFather, IsAngstroem))
             exit(1);
 #endif
-          //NumBonds[Runner->nr] += Binder->BondDegree;
+          //NumBonds[(*iter)->nr] += Binder->BondDegree;
         }
       }
     } else {
-      DoeLog(1) && (eLog()<< Verbose(1) << "Son " << Runner->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl);
-    }
-    if ((LonelyFlag) && (Leaf->AtomCount > 1)) {
-      DoLog(0) && (Log() << Verbose(0) << *Runner << "has got bonds only to hydrogens!" << endl);
-    }
+    DoeLog(1) && (eLog()<< Verbose(1) << "Son " << (*iter)->getName() << " has father " << FatherOfRunner->getName() << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl);
+    }
+    if ((LonelyFlag) && (Leaf->getAtomCount() > 1)) {
+      DoLog(0) && (Log() << Verbose(0) << **iter << "has got bonds only to hydrogens!" << endl);
+    }
+    ++iter;
 #ifdef ADDHYDROGEN
-    while ((Runner->next != Leaf->end) && (Runner->next->type->Z == 1)) // skip added hydrogen
-      Runner = Runner->next;
+    while ((iter != Leaf->end()) && ((*iter)->type->Z == 1)){ // skip added hydrogen
+      iter++;
+    }
 #endif
   }
@@ -929,6 +982,9 @@
 molecule * molecule::StoreFragmentFromKeySet(KeySet &Leaflet, bool IsAngstroem)
 {
-  atom **SonList = Calloc<atom*>(AtomCount, "molecule::StoreFragmentFromStack: **SonList");
+  atom **SonList = new atom*[getAtomCount()];
   molecule *Leaf = World::getInstance().createMolecule();
+
+  for(int i=0;i<getAtomCount();i++)
+    SonList[i] = NULL;
 
 //  Log() << Verbose(1) << "Begin of StoreFragmentFromKeyset." << endl;
@@ -939,5 +995,5 @@
 
   //Leaflet->Leaf->ScanForPeriodicCorrection(out);
-  Free(&SonList);
+  delete[](SonList);
 //  Log() << Verbose(1) << "End of StoreFragmentFromKeyset." << endl;
   return Leaf;
@@ -1084,6 +1140,5 @@
   int bits, TouchedIndex, SubSetDimension, SP, Added;
   int SpaceLeft;
-  int *TouchedList = Malloc<int>(SubOrder + 1, "molecule::SPFragmentGenerator: *TouchedList");
-  bond **BondsList = NULL;
+  int *TouchedList = new int[SubOrder + 1];
   KeySetTestPair TestKeySetInsert;
 
@@ -1124,5 +1179,5 @@
 
           // then allocate and fill the list
-          BondsList = Malloc<bond*>(SubSetDimension, "molecule::SPFragmentGenerator: **BondsList");
+          bond *BondsList[SubSetDimension];
           SubSetDimension = FillBondsList(BondsList, FragmentSearch->BondsPerSPList[2*SP], FragmentSearch->BondsPerSPList[2*SP+1], TouchedList, TouchedIndex);
 
@@ -1130,6 +1185,4 @@
           Log() << Verbose(2+verbosity) << "Calling subset generator " << SP << " away from root " << *FragmentSearch->Root << " with sub set dimension " << SubSetDimension << "." << endl;
           SPFragmentGenerator(FragmentSearch, SP, BondsList, SubSetDimension, SubOrder-bits);
-
-          Free(&BondsList);
         }
       } else {
@@ -1153,5 +1206,5 @@
     }
   }
-  Free(&TouchedList);
+  delete[](TouchedList);
   Log() << Verbose(1+verbosity) << "End of SPFragmentGenerator, " << RootDistance << " away from Root " << *FragmentSearch->Root << " and SubOrder is " << SubOrder << "." << endl;
 };
@@ -1165,6 +1218,6 @@
 void InitialiseSPList(int Order, struct UniqueFragments &FragmentSearch)
 {
-  FragmentSearch.BondsPerSPList = Malloc<bond*>(Order * 2, "molecule::PowerSetGenerator: ***BondsPerSPList");
-  FragmentSearch.BondsPerSPCount = Malloc<int>(Order, "molecule::PowerSetGenerator: *BondsPerSPCount");
+  FragmentSearch.BondsPerSPList = new bond* [Order * 2];
+  FragmentSearch.BondsPerSPCount = new int[Order];
   for (int i=Order;i--;) {
     FragmentSearch.BondsPerSPList[2*i] = new bond();    // start node
@@ -1184,10 +1237,10 @@
 void FreeSPList(int Order, struct UniqueFragments &FragmentSearch)
 {
-  Free(&FragmentSearch.BondsPerSPCount);
+  delete[](FragmentSearch.BondsPerSPCount);
   for (int i=Order;i--;) {
     delete(FragmentSearch.BondsPerSPList[2*i]);
     delete(FragmentSearch.BondsPerSPList[2*i+1]);
   }
-  Free(&FragmentSearch.BondsPerSPList);
+  delete[](FragmentSearch.BondsPerSPList);
 };
 
@@ -1370,5 +1423,4 @@
 int molecule::PowerSetGenerator(int Order, struct UniqueFragments &FragmentSearch, KeySet RestrictedKeySet)
 {
-  bond **BondsList = NULL;
   int Counter = FragmentSearch.FragmentCounter; // mark current value of counter
 
@@ -1394,10 +1446,10 @@
 
     // prepare the subset and call the generator
-    BondsList = Calloc<bond*>(FragmentSearch.BondsPerSPCount[0], "molecule::PowerSetGenerator: **BondsList");
+    bond* BondsList[FragmentSearch.BondsPerSPCount[0]];
+    for(int i=0;i<FragmentSearch.BondsPerSPCount[0];i++)
+      BondsList[i] = NULL;
     BondsList[0] = FragmentSearch.BondsPerSPList[0]->next;  // on SP level 0 there's only the root bond
 
     SPFragmentGenerator(&FragmentSearch, 0, BondsList, FragmentSearch.BondsPerSPCount[0], Order);
-
-    Free(&BondsList);
   } else {
     DoLog(0) && (Log() << Verbose(0) << "Not enough total number of edges to build " << Order << "-body fragments." << endl);
@@ -1507,8 +1559,8 @@
       }
     }
-    Free(&FragmentLowerOrdersList[RootNr]);
+    delete[](FragmentLowerOrdersList[RootNr]);
     RootNr++;
   }
-  Free(&FragmentLowerOrdersList);
+  delete[](FragmentLowerOrdersList);
 };
 
@@ -1549,6 +1601,11 @@
   // FragmentLowerOrdersList is a 2D-array of pointer to MoleculeListClass objects, one dimension represents the ANOVA expansion of a single order (i.e. 5)
   // with all needed lower orders that are subtracted, the other dimension is the BondOrder (i.e. from 1 to 5)
-  NumMoleculesOfOrder = Calloc<int>(UpgradeCount, "molecule::FragmentBOSSANOVA: *NumMoleculesOfOrder");
-  FragmentLowerOrdersList = Calloc<Graph**>(UpgradeCount, "molecule::FragmentBOSSANOVA: ***FragmentLowerOrdersList");
+  NumMoleculesOfOrder = new int[UpgradeCount];
+  FragmentLowerOrdersList = new Graph**[UpgradeCount];
+
+  for(int i=0;i<UpgradeCount;i++) {
+    NumMoleculesOfOrder[i] = 0;
+    FragmentLowerOrdersList[i] = NULL;
+  }
 
   // initialise the fragments structure
@@ -1556,15 +1613,13 @@
   FragmentSearch.FragmentSet = new KeySet;
   FragmentSearch.Root = FindAtom(RootKeyNr);
-  FragmentSearch.ShortestPathList = Malloc<int>(AtomCount, "molecule::PowerSetGenerator: *ShortestPathList");
-  for (int i=AtomCount;i--;) {
+  FragmentSearch.ShortestPathList = new int[getAtomCount()];
+  for (int i=getAtomCount();i--;) {
     FragmentSearch.ShortestPathList[i] = -1;
   }
 
   // Construct the complete KeySet which we need for topmost level only (but for all Roots)
-  atom *Walker = start;
   KeySet CompleteMolecule;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    CompleteMolecule.insert(Walker->GetTrueFather()->nr);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    CompleteMolecule.insert((*iter)->GetTrueFather()->nr);
   }
 
@@ -1577,5 +1632,5 @@
     RootKeyNr = RootStack.front();
     RootStack.pop_front();
-    Walker = FindAtom(RootKeyNr);
+    atom *Walker = FindAtom(RootKeyNr);
     // check cyclic lengths
     //if ((MinimumRingSize[Walker->GetTrueFather()->nr] != -1) && (Walker->GetTrueFather()->AdaptiveOrder+1 > MinimumRingSize[Walker->GetTrueFather()->nr])) {
@@ -1592,5 +1647,7 @@
       // allocate memory for all lower level orders in this 1D-array of ptrs
       NumLevels = 1 << (Order-1); // (int)pow(2,Order);
-      FragmentLowerOrdersList[RootNr] = Calloc<Graph*>(NumLevels, "molecule::FragmentBOSSANOVA: **FragmentLowerOrdersList[]");
+      FragmentLowerOrdersList[RootNr] = new Graph*[NumLevels];
+      for (int i=0;i<NumLevels;i++)
+        FragmentLowerOrdersList[RootNr][i] = NULL;
 
       // create top order where nothing is reduced
@@ -1628,5 +1685,5 @@
 
   // cleanup FragmentSearch structure
-  Free(&FragmentSearch.ShortestPathList);
+  delete[](FragmentSearch.ShortestPathList);
   delete(FragmentSearch.FragmentSet);
 
@@ -1641,5 +1698,5 @@
   CombineAllOrderListIntoOne(FragmentList, FragmentLowerOrdersList, RootStack, this);
   FreeAllOrdersList(FragmentLowerOrdersList, RootStack, this);
-  Free(&NumMoleculesOfOrder);
+  delete[](NumMoleculesOfOrder);
 
   DoLog(0) && (Log() << Verbose(0) << "End of FragmentBOSSANOVA." << endl);
@@ -1664,31 +1721,32 @@
   Vector Translationvector;
   //class StackClass<atom *> *CompStack = NULL;
-  class StackClass<atom *> *AtomStack = new StackClass<atom *>(AtomCount);
+  class StackClass<atom *> *AtomStack = new StackClass<atom *>(getAtomCount());
   bool flag = true;
 
   DoLog(2) && (Log() << Verbose(2) << "Begin of ScanForPeriodicCorrection." << endl);
 
-  ColorList = Calloc<enum Shading>(AtomCount, "molecule::ScanForPeriodicCorrection: *ColorList");
+  ColorList = new enum Shading[getAtomCount()];
+  for (int i=0;i<getAtomCount();i++)
+    ColorList[i] = (enum Shading)0;
   while (flag) {
     // remove bonds that are beyond bonddistance
-    for(int i=NDIM;i--;)
-      Translationvector[i] = 0.;
+    Translationvector.Zero();
     // scan all bonds
-    Binder = first;
     flag = false;
-    while ((!flag) && (Binder->next != last)) {
-      Binder = Binder->next;
-      for (int i=NDIM;i--;) {
-        tmp = fabs(Binder->leftatom->x[i] - Binder->rightatom->x[i]);
-        //Log() << Verbose(3) << "Checking " << i << "th distance of " << *Binder->leftatom << " to " << *Binder->rightatom << ": " << tmp << "." << endl;
-        if (tmp > BondDistance) {
-          OtherBinder = Binder->next; // note down binding partner for later re-insertion
-          unlink(Binder);   // unlink bond
-          DoLog(2) && (Log() << Verbose(2) << "Correcting at bond " << *Binder << "." << endl);
-          flag = true;
-          break;
+    for(molecule::iterator AtomRunner = begin(); (!flag) && (AtomRunner != end()); ++AtomRunner)
+      for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); (!flag) && (BondRunner != (*AtomRunner)->ListOfBonds.end()); ++BondRunner) {
+        Binder = (*BondRunner);
+        for (int i=NDIM;i--;) {
+          tmp = fabs(Binder->leftatom->x[i] - Binder->rightatom->x[i]);
+          //Log() << Verbose(3) << "Checking " << i << "th distance of " << *Binder->leftatom << " to " << *Binder->rightatom << ": " << tmp << "." << endl;
+          if (tmp > BondDistance) {
+            OtherBinder = Binder->next; // note down binding partner for later re-insertion
+            unlink(Binder);   // unlink bond
+            DoLog(2) && (Log() << Verbose(2) << "Correcting at bond " << *Binder << "." << endl);
+            flag = true;
+            break;
+          }
         }
       }
-    }
     if (flag) {
       // create translation vector from their periodically modified distance
@@ -1702,5 +1760,5 @@
       Log() << Verbose(0) << Translationvector <<  endl;
       // apply to all atoms of first component via BFS
-      for (int i=AtomCount;i--;)
+      for (int i=getAtomCount();i--;)
         ColorList[i] = white;
       AtomStack->Push(Binder->leftatom);
@@ -1726,9 +1784,8 @@
     //delete(CompStack);
   }
-
   // free allocated space from ReturnFullMatrixforSymmetric()
   delete(AtomStack);
-  Free(&ColorList);
-  Free(&matrix);
+  delete[](ColorList);
+  delete[](matrix);
   DoLog(2) && (Log() << Verbose(2) << "End of ScanForPeriodicCorrection." << endl);
 };
Index: src/molecule_geometry.cpp
===================================================================
--- src/molecule_geometry.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/molecule_geometry.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -27,4 +27,5 @@
   bool status = true;
   const Vector *Center = DetermineCenterOfAll();
+  const Vector *CenterBox = DetermineCenterOfBox();
   double * const cell_size = World::getInstance().getDomain();
   double *M = ReturnFullMatrixforSymmetric(cell_size);
@@ -33,8 +34,9 @@
   // go through all atoms
   ActOnAllVectors( &Vector::SubtractVector, *Center);
+  ActOnAllVectors( &Vector::SubtractVector, *CenterBox);
   ActOnAllVectors( &Vector::WrapPeriodically, (const double *)M, (const double *)Minv);
 
-  Free(&M);
-  Free(&Minv);
+  delete[](M);
+  delete[](Minv);
   delete(Center);
   return status;
@@ -55,6 +57,6 @@
   ActOnAllVectors( &Vector::WrapPeriodically, (const double *)M, (const double *)Minv);
 
-  Free(&M);
-  Free(&Minv);
+  delete[](M);
+  delete[](Minv);
   return status;
 };
@@ -69,16 +71,15 @@
 
 //  Log() << Verbose(3) << "Begin of CenterEdge." << endl;
-  atom *ptr = start->next;  // start at first in list
-  if (ptr != end) {   //list not empty?
+  molecule::const_iterator iter = begin();  // start at first in list
+  if (iter != end()) { //list not empty?
     for (int i=NDIM;i--;) {
-      max->at(i) = ptr->x[i];
-      min->at(i) = ptr->x[i];
-    }
-    while (ptr->next != end) {  // continue with second if present
-      ptr = ptr->next;
-      //ptr->Output(1,1,out);
+      max->at(i) = (*iter)->x[i];
+      min->at(i) = (*iter)->x[i];
+    }
+    for (; iter != end(); ++iter) {// continue with second if present
+      //(*iter)->Output(1,1,out);
       for (int i=NDIM;i--;) {
-        max->at(i) = (max->at(i) < ptr->x[i]) ? ptr->x[i] : max->at(i);
-        min->at(i) = (min->at(i) > ptr->x[i]) ? ptr->x[i] : min->at(i);
+        max->at(i) = (max->at(i) < (*iter)->x[i]) ? (*iter)->x[i] : max->at(i);
+        min->at(i) = (min->at(i) > (*iter)->x[i]) ? (*iter)->x[i] : min->at(i);
       }
     }
@@ -104,13 +105,12 @@
 {
   int Num = 0;
-  atom *ptr = start;  // start at first in list
+  molecule::const_iterator iter = begin();  // start at first in list
 
   Center.Zero();
 
-  if (ptr->next != end) {   //list not empty?
-    while (ptr->next != end) {  // continue with second if present
-      ptr = ptr->next;
+  if (iter != end()) {   //list not empty?
+    for (; iter != end(); ++iter) {  // continue with second if present
       Num++;
-      Center += ptr->x;
+      Center += (*iter)->x;
     }
     Center.Scale(-1./Num); // divide through total number (and sign for direction)
@@ -125,5 +125,42 @@
 Vector * molecule::DetermineCenterOfAll() const
 {
-  atom *ptr = start->next;  // start at first in list
+  molecule::const_iterator iter = begin();  // start at first in list
+  Vector *a = new Vector();
+  double Num = 0;
+
+  a->Zero();
+
+  if (iter != end()) {   //list not empty?
+    for (; iter != end(); ++iter) {  // continue with second if present
+      Num++;
+      (*a) += (*iter)->x;
+    }
+    a->Scale(1./Num); // divide through total mass (and sign for direction)
+  }
+  return a;
+};
+
+/** Returns vector pointing to center of the domain.
+ * \return pointer to center of the domain
+ */
+Vector * molecule::DetermineCenterOfBox() const
+{
+  Vector *a = new Vector(0.5,0.5,0.5);
+
+  const double *cell_size = World::getInstance().getDomain();
+  double *M = ReturnFullMatrixforSymmetric(cell_size);
+  a->MatrixMultiplication(M);
+  delete[](M);
+
+  return a;
+};
+
+/** Returns vector pointing to center of gravity.
+ * \param *out output stream for debugging
+ * \return pointer to center of gravity vector
+ */
+Vector * molecule::DetermineCenterOfGravity()
+{
+  molecule::const_iterator iter = begin();  // start at first in list
   Vector *a = new Vector();
   Vector tmp;
@@ -132,37 +169,11 @@
   a->Zero();
 
-  if (ptr != end) {   //list not empty?
-    while (ptr->next != end) {  // continue with second if present
-      ptr = ptr->next;
-      Num += 1.;
-      tmp = ptr->x;
+  if (iter != end()) {   //list not empty?
+    for (; iter != end(); ++iter) {  // continue with second if present
+      Num += (*iter)->type->mass;
+      tmp = (*iter)->type->mass * (*iter)->x;
       (*a) += tmp;
     }
     a->Scale(1./Num); // divide through total mass (and sign for direction)
-  }
-  return a;
-};
-
-/** Returns vector pointing to center of gravity.
- * \param *out output stream for debugging
- * \return pointer to center of gravity vector
- */
-Vector * molecule::DetermineCenterOfGravity()
-{
-  atom *ptr = start->next;  // start at first in list
-  Vector *a = new Vector();
-  Vector tmp;
-  double Num = 0;
-
-  a->Zero();
-
-  if (ptr != end) {   //list not empty?
-    while (ptr->next != end) {  // continue with second if present
-      ptr = ptr->next;
-      Num += ptr->type->mass;
-      tmp = ptr->type->mass * ptr->x;
-      (*a) += tmp;
-    }
-    a->Scale(-1./Num); // divide through total mass (and sign for direction)
   }
 //  Log() << Verbose(1) << "Resulting center of gravity: ";
@@ -202,11 +213,8 @@
 void molecule::Scale(const double ** const factor)
 {
-  atom *ptr = start;
-
-  while (ptr->next != end) {
-    ptr = ptr->next;
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     for (int j=0;j<MDSteps;j++)
-      ptr->Trajectory.R.at(j).ScaleAll(*factor);
-    ptr->x.ScaleAll(*factor);
+      (*iter)->Trajectory.R.at(j).ScaleAll(*factor);
+    (*iter)->x.ScaleAll(*factor);
   }
 };
@@ -217,11 +225,8 @@
 void molecule::Translate(const Vector *trans)
 {
-  atom *ptr = start;
-
-  while (ptr->next != end) {
-    ptr = ptr->next;
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     for (int j=0;j<MDSteps;j++)
-      ptr->Trajectory.R.at(j) += (*trans);
-    ptr->x += (*trans);
+      (*iter)->Trajectory.R.at(j) += (*trans);
+    (*iter)->x += (*trans);
   }
 };
@@ -238,9 +243,9 @@
 
   // go through all atoms
-  ActOnAllVectors( &Vector::SubtractVector, *trans);
+  ActOnAllVectors( &Vector::AddVector, *trans);
   ActOnAllVectors( &Vector::WrapPeriodically, (const double *)M, (const double *)Minv);
 
-  Free(&M);
-  Free(&Minv);
+  delete[](M);
+  delete[](Minv);
 };
 
@@ -259,8 +264,7 @@
 void molecule::DeterminePeriodicCenter(Vector &center)
 {
-  atom *Walker = start;
   double * const cell_size = World::getInstance().getDomain();
   double *matrix = ReturnFullMatrixforSymmetric(cell_size);
-  double *inversematrix = InverseMatrix(cell_size);
+  double *inversematrix = InverseMatrix(matrix);
   double tmp;
   bool flag;
@@ -270,19 +274,18 @@
     Center.Zero();
     flag = true;
-    while (Walker->next != end) {
-      Walker = Walker->next;
+    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
 #ifdef ADDHYDROGEN
-      if (Walker->type->Z != 1) {
+      if ((*iter)->type->Z != 1) {
 #endif
-        Testvector = Walker->x;
+        Testvector = (*iter)->x;
         Testvector.MatrixMultiplication(inversematrix);
         Translationvector.Zero();
-        for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
-         if (Walker->nr < (*Runner)->GetOtherAtom(Walker)->nr) // otherwise we shift one to, the other fro and gain nothing
+        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
+         if ((*iter)->nr < (*Runner)->GetOtherAtom((*iter))->nr) // otherwise we shift one to, the other fro and gain nothing
             for (int j=0;j<NDIM;j++) {
-              tmp = Walker->x[j] - (*Runner)->GetOtherAtom(Walker)->x[j];
+              tmp = (*iter)->x[j] - (*Runner)->GetOtherAtom(*iter)->x[j];
               if ((fabs(tmp)) > BondDistance) {
                 flag = false;
-                DoLog(0) && (Log() << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl);
+                DoLog(0) && (Log() << Verbose(0) << "Hit: atom " << (*iter)->getName() << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl);
                 if (tmp > 0)
                   Translationvector[j] -= 1.;
@@ -298,7 +301,7 @@
 #ifdef ADDHYDROGEN
         // now also change all hydrogens
-        for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
-          if ((*Runner)->GetOtherAtom(Walker)->type->Z == 1) {
-            Testvector = (*Runner)->GetOtherAtom(Walker)->x;
+        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
+          if ((*Runner)->GetOtherAtom((*iter))->type->Z == 1) {
+            Testvector = (*Runner)->GetOtherAtom((*iter))->x;
             Testvector.MatrixMultiplication(inversematrix);
             Testvector += Translationvector;
@@ -312,8 +315,8 @@
     }
   } while (!flag);
-  Free(&matrix);
-  Free(&inversematrix);
-
-  Center.Scale(1./(double)AtomCount);
+  delete[](matrix);
+  delete[](inversematrix);
+
+  Center.Scale(1./static_cast<double>(getAtomCount()));
 };
 
@@ -325,5 +328,4 @@
 void molecule::PrincipalAxisSystem(bool DoRotate)
 {
-  atom *ptr = start;  // start at first in list
   double InertiaTensor[NDIM*NDIM];
   Vector *CenterOfGravity = DetermineCenterOfGravity();
@@ -336,17 +338,16 @@
 
   // sum up inertia tensor
-  while (ptr->next != end) {
-    ptr = ptr->next;
-    Vector x = ptr->x;
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    Vector x = (*iter)->x;
     //x.SubtractVector(CenterOfGravity);
-    InertiaTensor[0] += ptr->type->mass*(x[1]*x[1] + x[2]*x[2]);
-    InertiaTensor[1] += ptr->type->mass*(-x[0]*x[1]);
-    InertiaTensor[2] += ptr->type->mass*(-x[0]*x[2]);
-    InertiaTensor[3] += ptr->type->mass*(-x[1]*x[0]);
-    InertiaTensor[4] += ptr->type->mass*(x[0]*x[0] + x[2]*x[2]);
-    InertiaTensor[5] += ptr->type->mass*(-x[1]*x[2]);
-    InertiaTensor[6] += ptr->type->mass*(-x[2]*x[0]);
-    InertiaTensor[7] += ptr->type->mass*(-x[2]*x[1]);
-    InertiaTensor[8] += ptr->type->mass*(x[0]*x[0] + x[1]*x[1]);
+    InertiaTensor[0] += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
+    InertiaTensor[1] += (*iter)->type->mass*(-x[0]*x[1]);
+    InertiaTensor[2] += (*iter)->type->mass*(-x[0]*x[2]);
+    InertiaTensor[3] += (*iter)->type->mass*(-x[1]*x[0]);
+    InertiaTensor[4] += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
+    InertiaTensor[5] += (*iter)->type->mass*(-x[1]*x[2]);
+    InertiaTensor[6] += (*iter)->type->mass*(-x[2]*x[0]);
+    InertiaTensor[7] += (*iter)->type->mass*(-x[2]*x[1]);
+    InertiaTensor[8] += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
   }
   // print InertiaTensor for debugging
@@ -386,18 +387,15 @@
 
     // sum up inertia tensor
-    ptr = start;
-    while (ptr->next != end) {
-      ptr = ptr->next;
-      Vector x = ptr->x;
-      //x.SubtractVector(CenterOfGravity);
-      InertiaTensor[0] += ptr->type->mass*(x[1]*x[1] + x[2]*x[2]);
-      InertiaTensor[1] += ptr->type->mass*(-x[0]*x[1]);
-      InertiaTensor[2] += ptr->type->mass*(-x[0]*x[2]);
-      InertiaTensor[3] += ptr->type->mass*(-x[1]*x[0]);
-      InertiaTensor[4] += ptr->type->mass*(x[0]*x[0] + x[2]*x[2]);
-      InertiaTensor[5] += ptr->type->mass*(-x[1]*x[2]);
-      InertiaTensor[6] += ptr->type->mass*(-x[2]*x[0]);
-      InertiaTensor[7] += ptr->type->mass*(-x[2]*x[1]);
-      InertiaTensor[8] += ptr->type->mass*(x[0]*x[0] + x[1]*x[1]);
+    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+      Vector x = (*iter)->x;
+      InertiaTensor[0] += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
+      InertiaTensor[1] += (*iter)->type->mass*(-x[0]*x[1]);
+      InertiaTensor[2] += (*iter)->type->mass*(-x[0]*x[2]);
+      InertiaTensor[3] += (*iter)->type->mass*(-x[1]*x[0]);
+      InertiaTensor[4] += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
+      InertiaTensor[5] += (*iter)->type->mass*(-x[1]*x[2]);
+      InertiaTensor[6] += (*iter)->type->mass*(-x[2]*x[0]);
+      InertiaTensor[7] += (*iter)->type->mass*(-x[2]*x[1]);
+      InertiaTensor[8] += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
     }
     // print InertiaTensor for debugging
@@ -423,5 +421,4 @@
 void molecule::Align(Vector *n)
 {
-  atom *ptr = start;
   double alpha, tmp;
   Vector z_axis;
@@ -434,13 +431,12 @@
   alpha = atan(-n->at(0)/n->at(2));
   DoLog(1) && (Log() << Verbose(1) << "Z-X-angle: " << alpha << " ... ");
-  while (ptr->next != end) {
-    ptr = ptr->next;
-    tmp = ptr->x[0];
-    ptr->x[0] =  cos(alpha) * tmp + sin(alpha) * ptr->x[2];
-    ptr->x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->x[2];
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    tmp = (*iter)->x[0];
+    (*iter)->x[0] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
+    (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
     for (int j=0;j<MDSteps;j++) {
-      tmp = ptr->Trajectory.R.at(j)[0];
-      ptr->Trajectory.R.at(j)[0] =  cos(alpha) * tmp + sin(alpha) * ptr->Trajectory.R.at(j)[2];
-      ptr->Trajectory.R.at(j)[2] = -sin(alpha) * tmp + cos(alpha) * ptr->Trajectory.R.at(j)[2];
+      tmp = (*iter)->Trajectory.R.at(j)[0];
+      (*iter)->Trajectory.R.at(j)[0] =  cos(alpha) * tmp + sin(alpha) * (*iter)->Trajectory.R.at(j)[2];
+      (*iter)->Trajectory.R.at(j)[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->Trajectory.R.at(j)[2];
     }
   }
@@ -452,16 +448,14 @@
 
   // rotate on z-y plane
-  ptr = start;
   alpha = atan(-n->at(1)/n->at(2));
   DoLog(1) && (Log() << Verbose(1) << "Z-Y-angle: " << alpha << " ... ");
-  while (ptr->next != end) {
-    ptr = ptr->next;
-    tmp = ptr->x[1];
-    ptr->x[1] =  cos(alpha) * tmp + sin(alpha) * ptr->x[2];
-    ptr->x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->x[2];
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    tmp = (*iter)->x[1];
+    (*iter)->x[1] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
+    (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
     for (int j=0;j<MDSteps;j++) {
-      tmp = ptr->Trajectory.R.at(j)[1];
-      ptr->Trajectory.R.at(j)[1] =  cos(alpha) * tmp + sin(alpha) * ptr->Trajectory.R.at(j)[2];
-      ptr->Trajectory.R.at(j)[2] = -sin(alpha) * tmp + cos(alpha) * ptr->Trajectory.R.at(j)[2];
+      tmp = (*iter)->Trajectory.R.at(j)[1];
+      (*iter)->Trajectory.R.at(j)[1] =  cos(alpha) * tmp + sin(alpha) * (*iter)->Trajectory.R.at(j)[2];
+      (*iter)->Trajectory.R.at(j)[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->Trajectory.R.at(j)[2];
     }
   }
@@ -487,5 +481,4 @@
   Vector a,b,c,d;
   struct lsq_params *par = (struct lsq_params *)params;
-  atom *ptr = par->mol->start;
 
   // initialize vectors
@@ -497,8 +490,7 @@
   b[2] = gsl_vector_get(x,5);
   // go through all atoms
-  while (ptr != par->mol->end) {
-    ptr = ptr->next;
-    if (ptr->type == ((struct lsq_params *)params)->type) { // for specific type
-      c = ptr->x - a;
+  for (molecule::const_iterator iter = par->mol->begin(); iter != par->mol->end(); ++iter) {
+    if ((*iter)->type == ((struct lsq_params *)params)->type) { // for specific type
+      c = (*iter)->x - a;
       t = c.ScalarProduct(b);           // get direction parameter
       d = t*b;       // and create vector
Index: src/molecule_graph.cpp
===================================================================
--- src/molecule_graph.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/molecule_graph.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -12,4 +12,5 @@
 #include "element.hpp"
 #include "helpers.hpp"
+#include "info.hpp"
 #include "linkedcell.hpp"
 #include "lists.hpp"
@@ -19,4 +20,6 @@
 #include "World.hpp"
 #include "Helpers/fast_functions.hpp"
+#include "Helpers/Assert.hpp"
+
 
 struct BFSAccounting
@@ -54,25 +57,33 @@
 void molecule::CreateAdjacencyListFromDbondFile(ifstream *input)
 {
-
+  Info FunctionInfo(__func__);
   // 1 We will parse bonds out of the dbond file created by tremolo.
   int atom1, atom2;
   atom *Walker, *OtherWalker;
-
-  if (!input) {
-    DoLog(1) && (Log() << Verbose(1) << "Opening silica failed \n");
+  char line[MAXSTRINGSIZE];
+
+  if (input->fail()) {
+    DoeLog(0) && (eLog() << Verbose(0) << "Opening of bond file failed \n");
+    performCriticalExit();
   };
-
-  *input >> ws >> atom1;
-  *input >> ws >> atom2;
-  DoLog(1) && (Log() << Verbose(1) << "Scanning file\n");
+  doCountAtoms();
+
+  // skip header
+  input->getline(line,MAXSTRINGSIZE);
+  DoLog(1) && (Log() << Verbose(1) << "Scanning file ... \n");
   while (!input->eof()) // Check whether we read everything already
   {
-    *input >> ws >> atom1;
-    *input >> ws >> atom2;
-
+    input->getline(line,MAXSTRINGSIZE);
+    stringstream zeile(line);
+    zeile >> atom1;
+    zeile >> atom2;
+
+    DoLog(2) && (Log() << Verbose(2) << "Looking for atoms " << atom1 << " and " << atom2 << "." << endl);
     if (atom2 < atom1) //Sort indices of atoms in order
       flip(atom1, atom2);
     Walker = FindAtom(atom1);
+    ASSERT(Walker,"Could not find an atom with the ID given in dbond file");
     OtherWalker = FindAtom(atom2);
+    ASSERT(OtherWalker,"Could not find an atom with the ID given in dbond file");
     AddBond(Walker, OtherWalker); //Add the bond between the two atoms with respective indices.
   }
@@ -103,5 +114,4 @@
   atom *Walker = NULL;
   atom *OtherWalker = NULL;
-  atom **AtomMap = NULL;
   int n[NDIM];
   double MinDistance, MaxDistance;
@@ -118,18 +128,14 @@
   DoLog(0) && (Log() << Verbose(0) << "Begin of CreateAdjacencyList." << endl);
   // remove every bond from the list
-  bond *Binder = NULL;
-  while (last->previous != first) {
-    Binder = last->previous;
-    Binder->leftatom->UnregisterBond(Binder);
-    Binder->rightatom->UnregisterBond(Binder);
-    removewithoutcheck(Binder);
-  }
+  for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
+    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
+      if ((*BondRunner)->leftatom == *AtomRunner)
+        delete((*BondRunner));
   BondCount = 0;
 
   // count atoms in molecule = dimension of matrix (also give each unique name and continuous numbering)
-  CountAtoms();
-  DoLog(1) && (Log() << Verbose(1) << "AtomCount " << AtomCount << " and bonddistance is " << bonddistance << "." << endl);
-
-  if ((AtomCount > 1) && (bonddistance > 1.)) {
+  DoLog(1) && (Log() << Verbose(1) << "AtomCount " << getAtomCount() << " and bonddistance is " << bonddistance << "." << endl);
+
+  if ((getAtomCount() > 1) && (bonddistance > 1.)) {
     DoLog(2) && (Log() << Verbose(2) << "Creating Linked Cell structure ... " << endl);
     LC = new LinkedCell(this, bonddistance);
@@ -137,9 +143,9 @@
     // create a list to map Tesselpoint::nr to atom *
     DoLog(2) && (Log() << Verbose(2) << "Creating TesselPoint to atom map ... " << endl);
-    AtomMap = Calloc<atom *> (AtomCount, "molecule::CreateAdjacencyList - **AtomCount");
-    Walker = start;
-    while (Walker->next != end) {
-      Walker = Walker->next;
-      AtomMap[Walker->nr] = Walker;
+
+    // set numbers for atoms that can later be used
+    int i=0;
+    for(internal_iterator iter = atoms.begin();iter!= atoms.end(); ++iter){
+      (*iter)->nr = i++;
     }
 
@@ -153,6 +159,7 @@
           if (List != NULL) {
             for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
-              Walker = AtomMap[(*Runner)->nr];
-//              Log() << Verbose(0) << "Current Atom is " << *Walker << "." << endl;
+              Walker = dynamic_cast<atom*>(*Runner);
+              ASSERT(Walker,"Tesselpoint that was not an atom retrieved from LinkedNode");
+              //Log() << Verbose(0) << "Current Atom is " << *Walker << "." << endl;
               // 3c. check for possible bond between each atom in this and every one in the 27 cells
               for (n[0] = -1; n[0] <= 1; n[0]++)
@@ -164,9 +171,9 @@
                       for (LinkedCell::LinkedNodes::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) {
                         if ((*OtherRunner)->nr > Walker->nr) {
-                          OtherWalker = AtomMap[(*OtherRunner)->nr];
-//                          Log() << Verbose(0) << "Current other Atom is " << *OtherWalker << "." << endl;
-                          const double distance = OtherWalker->x.PeriodicDistanceSquared(Walker->x, cell_size);
-//                          Log() << Verbose(1) << "Checking distance " << distance << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
+                          OtherWalker = dynamic_cast<atom*>(*OtherRunner);
+                          ASSERT(OtherWalker,"TesselPoint that was not an atom retrieved from LinkedNode");
+                          //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
                           (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
+                          const double distance = OtherWalker->x.PeriodicDistanceSquared(Walker->x,cell_size);
                           const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance);
 //                          Log() << Verbose(1) << "MinDistance is " << MinDistance << " and MaxDistance is " << MaxDistance << "." << endl;
@@ -188,5 +195,4 @@
           }
         }
-    Free(&AtomMap);
     delete (LC);
     DoLog(1) && (Log() << Verbose(1) << "I detected " << BondCount << " bonds in the molecule with distance " << BondDistance << "." << endl);
@@ -199,5 +205,5 @@
     ActOnAllAtoms( &atom::OutputBondOfAtom );
   } else
-    DoLog(1) && (Log() << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "AtomCount is " << getAtomCount() << ", thus no bonds, no connections!." << endl);
   DoLog(0) && (Log() << Verbose(0) << "End of CreateAdjacencyList." << endl);
   if (free_BG)
@@ -206,4 +212,29 @@
 ;
 
+/** Checks for presence of bonds within atom list.
+ * TODO: more sophisticated check for bond structure (e.g. connected subgraph, ...)
+ * \return true - bonds present, false - no bonds
+ */
+bool molecule::hasBondStructure()
+{
+  for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
+    if (!(*AtomRunner)->ListOfBonds.empty())
+      return true;
+  return false;
+}
+
+/** Counts the number of present bonds.
+ * \return number of bonds
+ */
+unsigned int molecule::CountBonds() const
+{
+  unsigned int counter = 0;
+  for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
+    for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
+      if ((*BondRunner)->leftatom == *AtomRunner)
+        counter++;
+  return counter;
+}
+
 /** Prints a list of all bonds to \a *out.
  * \param output stream
@@ -212,9 +243,9 @@
 {
   DoLog(1) && (Log() << Verbose(1) << endl << "From contents of bond chain list:");
-  bond *Binder = first;
-  while (Binder->next != last) {
-    Binder = Binder->next;
-    DoLog(0) && (Log() << Verbose(0) << *Binder << "\t" << endl);
-  }
+  for(molecule::const_iterator AtomRunner = molecule::begin(); AtomRunner != molecule::end(); ++AtomRunner)
+    for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
+      if ((*BondRunner)->leftatom == *AtomRunner) {
+        DoLog(0) && (Log() << Verbose(0) << *(*BondRunner) << "\t" << endl);
+      }
   DoLog(0) && (Log() << Verbose(0) << endl);
 }
@@ -241,5 +272,5 @@
     DoLog(0) && (Log() << Verbose(0) << " done." << endl);
   } else {
-    DoLog(1) && (Log() << Verbose(1) << "BondCount is " << BondCount << ", no bonds between any of the " << AtomCount << " atoms." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "BondCount is " << BondCount << ", no bonds between any of the " << getAtomCount() << " atoms." << endl);
   }
   DoLog(0) && (Log() << Verbose(0) << No << " bonds could not be corrected." << endl);
@@ -260,20 +291,21 @@
   MoleculeLeafClass *Subgraphs = NULL;
   class StackClass<bond *> *BackEdgeStack = NULL;
-  bond *Binder = first;
-  if ((Binder->next != last) && (Binder->next->Type == Undetermined)) {
-    DoLog(0) && (Log() << Verbose(0) << "No Depth-First-Search analysis performed so far, calling ..." << endl);
-    Subgraphs = DepthFirstSearchAnalysis(BackEdgeStack);
-    while (Subgraphs->next != NULL) {
-      Subgraphs = Subgraphs->next;
-      delete (Subgraphs->previous);
-    }
-    delete (Subgraphs);
-    delete[] (MinimumRingSize);
-  }
-  while (Binder->next != last) {
-    Binder = Binder->next;
-    if (Binder->Cyclic)
-      NoCyclicBonds++;
-  }
+  for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
+    if ((!(*AtomRunner)->ListOfBonds.empty()) && ((*(*AtomRunner)->ListOfBonds.begin())->Type == Undetermined)) {
+      DoLog(0) && (Log() << Verbose(0) << "No Depth-First-Search analysis performed so far, calling ..." << endl);
+      Subgraphs = DepthFirstSearchAnalysis(BackEdgeStack);
+      while (Subgraphs->next != NULL) {
+        Subgraphs = Subgraphs->next;
+        delete (Subgraphs->previous);
+      }
+      delete (Subgraphs);
+      delete[] (MinimumRingSize);
+      break;
+    }
+  for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
+    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
+      if ((*BondRunner)->leftatom == *AtomRunner)
+        if ((*BondRunner)->Cyclic)
+          NoCyclicBonds++;
   delete (BackEdgeStack);
   return NoCyclicBonds;
@@ -317,5 +349,5 @@
     Walker->GraphNr = DFS.CurrentGraphNr;
     Walker->LowpointNr = DFS.CurrentGraphNr;
-    DoLog(1) && (Log() << Verbose(1) << "Setting Walker[" << Walker->Name << "]'s number to " << Walker->GraphNr << " with Lowpoint " << Walker->LowpointNr << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "Setting Walker[" << Walker->getName() << "]'s number to " << Walker->GraphNr << " with Lowpoint " << Walker->LowpointNr << "." << endl);
     DFS.AtomStack->Push(Walker);
     DFS.CurrentGraphNr++;
@@ -348,5 +380,5 @@
     Binder->MarkUsed(black);
     OtherAtom = Binder->GetOtherAtom(Walker);
-    DoLog(2) && (Log() << Verbose(2) << "(4) OtherAtom is " << OtherAtom->Name << "." << endl);
+    DoLog(2) && (Log() << Verbose(2) << "(4) OtherAtom is " << OtherAtom->getName() << "." << endl);
     if (OtherAtom->GraphNr != -1) {
       // (4a) ... if "other" atom has been visited (GraphNr != 0), set lowpoint to minimum of both, go to (3)
@@ -354,5 +386,5 @@
       DFS.BackEdgeStack->Push(Binder);
       Walker->LowpointNr = (Walker->LowpointNr < OtherAtom->GraphNr) ? Walker->LowpointNr : OtherAtom->GraphNr;
-      DoLog(3) && (Log() << Verbose(3) << "(4a) Visited: Setting Lowpoint of Walker[" << Walker->Name << "] to " << Walker->LowpointNr << "." << endl);
+      DoLog(3) && (Log() << Verbose(3) << "(4a) Visited: Setting Lowpoint of Walker[" << Walker->getName() << "] to " << Walker->LowpointNr << "." << endl);
     } else {
       // (4b) ... otherwise set OtherAtom as Ancestor of Walker and Walker as OtherAtom, go to (2)
@@ -360,5 +392,5 @@
       OtherAtom->Ancestor = Walker;
       Walker = OtherAtom;
-      DoLog(3) && (Log() << Verbose(3) << "(4b) Not Visited: OtherAtom[" << OtherAtom->Name << "]'s Ancestor is now " << OtherAtom->Ancestor->Name << ", Walker is OtherAtom " << OtherAtom->Name << "." << endl);
+      DoLog(3) && (Log() << Verbose(3) << "(4b) Not Visited: OtherAtom[" << OtherAtom->getName() << "]'s Ancestor is now " << OtherAtom->Ancestor->getName() << ", Walker is OtherAtom " << OtherAtom->getName() << "." << endl);
       break;
     }
@@ -382,5 +414,5 @@
 
   // (5) if Ancestor of Walker is ...
-  DoLog(1) && (Log() << Verbose(1) << "(5) Number of Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "] is " << Walker->Ancestor->GraphNr << "." << endl);
+  DoLog(1) && (Log() << Verbose(1) << "(5) Number of Walker[" << Walker->getName() << "]'s Ancestor[" << Walker->Ancestor->getName() << "] is " << Walker->Ancestor->GraphNr << "." << endl);
 
   if (Walker->Ancestor->GraphNr != DFS.Root->GraphNr) {
@@ -389,23 +421,23 @@
       // (6a) set Ancestor's Lowpoint number to minimum of of its Ancestor and itself, go to Step(8)
       Walker->Ancestor->LowpointNr = (Walker->Ancestor->LowpointNr < Walker->LowpointNr) ? Walker->Ancestor->LowpointNr : Walker->LowpointNr;
-      DoLog(2) && (Log() << Verbose(2) << "(6) Setting Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s Lowpoint to " << Walker->Ancestor->LowpointNr << "." << endl);
+      DoLog(2) && (Log() << Verbose(2) << "(6) Setting Walker[" << Walker->getName() << "]'s Ancestor[" << Walker->Ancestor->getName() << "]'s Lowpoint to " << Walker->Ancestor->LowpointNr << "." << endl);
     } else {
       // (7) (Ancestor of Walker is a separating vertex, remove all from stack till Walker (including), these and Ancestor form a component
       Walker->Ancestor->SeparationVertex = true;
-      DoLog(2) && (Log() << Verbose(2) << "(7) Walker[" << Walker->Name << "]'s Ancestor[" << Walker->Ancestor->Name << "]'s is a separating vertex, creating component." << endl);
+      DoLog(2) && (Log() << Verbose(2) << "(7) Walker[" << Walker->getName() << "]'s Ancestor[" << Walker->Ancestor->getName() << "]'s is a separating vertex, creating component." << endl);
       mol->SetNextComponentNumber(Walker->Ancestor, DFS.ComponentNumber);
-      DoLog(3) && (Log() << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Ancestor's Compont is " << DFS.ComponentNumber << "." << endl);
+      DoLog(3) && (Log() << Verbose(3) << "(7) Walker[" << Walker->getName() << "]'s Ancestor's Compont is " << DFS.ComponentNumber << "." << endl);
       mol->SetNextComponentNumber(Walker, DFS.ComponentNumber);
-      DoLog(3) && (Log() << Verbose(3) << "(7) Walker[" << Walker->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
+      DoLog(3) && (Log() << Verbose(3) << "(7) Walker[" << Walker->getName() << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
       do {
         OtherAtom = DFS.AtomStack->PopLast();
         LeafWalker->Leaf->AddCopyAtom(OtherAtom);
         mol->SetNextComponentNumber(OtherAtom, DFS.ComponentNumber);
-        DoLog(3) && (Log() << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
+        DoLog(3) && (Log() << Verbose(3) << "(7) Other[" << OtherAtom->getName() << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
       } while (OtherAtom != Walker);
       DFS.ComponentNumber++;
     }
     // (8) Walker becomes its Ancestor, go to (3)
-    DoLog(2) && (Log() << Verbose(2) << "(8) Walker[" << Walker->Name << "] is now its Ancestor " << Walker->Ancestor->Name << ", backstepping. " << endl);
+    DoLog(2) && (Log() << Verbose(2) << "(8) Walker[" << Walker->getName() << "] is now its Ancestor " << Walker->Ancestor->getName() << ", backstepping. " << endl);
     Walker = Walker->Ancestor;
     DFS.BackStepping = true;
@@ -431,12 +463,12 @@
     //DFS.AtomStack->Output(out);
     mol->SetNextComponentNumber(DFS.Root, DFS.ComponentNumber);
-    DoLog(3) && (Log() << Verbose(3) << "(9) Root[" << DFS.Root->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl);
+    DoLog(3) && (Log() << Verbose(3) << "(9) Root[" << DFS.Root->getName() << "]'s Component is " << DFS.ComponentNumber << "." << endl);
     mol->SetNextComponentNumber(Walker, DFS.ComponentNumber);
-    DoLog(3) && (Log() << Verbose(3) << "(9) Walker[" << Walker->Name << "]'s Component is " << DFS.ComponentNumber << "." << endl);
+    DoLog(3) && (Log() << Verbose(3) << "(9) Walker[" << Walker->getName() << "]'s Component is " << DFS.ComponentNumber << "." << endl);
     do {
       OtherAtom = DFS.AtomStack->PopLast();
       LeafWalker->Leaf->AddCopyAtom(OtherAtom);
       mol->SetNextComponentNumber(OtherAtom, DFS.ComponentNumber);
-      DoLog(3) && (Log() << Verbose(3) << "(7) Other[" << OtherAtom->Name << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
+      DoLog(3) && (Log() << Verbose(3) << "(7) Other[" << OtherAtom->getName() << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
     } while (OtherAtom != Walker);
     DFS.ComponentNumber++;
@@ -445,5 +477,5 @@
     Walker = DFS.Root;
     Binder = mol->FindNextUnused(Walker);
-    DoLog(1) && (Log() << Verbose(1) << "(10) Walker is Root[" << DFS.Root->Name << "], next Unused Bond is " << Binder << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "(10) Walker is Root[" << DFS.Root->getName() << "], next Unused Bond is " << Binder << "." << endl);
     if (Binder != NULL) { // Root is separation vertex
       DoLog(1) && (Log() << Verbose(1) << "(11) Root is a separation vertex." << endl);
@@ -461,5 +493,5 @@
 void DepthFirstSearchAnalysis_Init(struct DFSAccounting &DFS, const molecule * const mol)
 {
-  DFS.AtomStack = new StackClass<atom *> (mol->AtomCount);
+  DFS.AtomStack = new StackClass<atom *> (mol->getAtomCount());
   DFS.CurrentGraphNr = 0;
   DFS.ComponentNumber = 0;
@@ -502,11 +534,11 @@
   bond *Binder = NULL;
 
-  if (AtomCount == 0)
+  if (getAtomCount() == 0)
     return SubGraphs;
   DoLog(0) && (Log() << Verbose(0) << "Begin of DepthFirstSearchAnalysis" << endl);
   DepthFirstSearchAnalysis_Init(DFS, this);
 
-  DFS.Root = start->next;
-  while (DFS.Root != end) { // if there any atoms at all
+  for (molecule::const_iterator iter = begin(); iter != end();) {
+    DFS.Root = *iter;
     // (1) mark all edges unused, empty stack, set atom->GraphNr = -1 for all
     DFS.AtomStack->ClearStack();
@@ -548,8 +580,8 @@
 
     // step on to next root
-    while ((DFS.Root != end) && (DFS.Root->GraphNr != -1)) {
-      //Log() << Verbose(1) << "Current next subgraph root candidate is " << Root->Name << "." << endl;
-      if (DFS.Root->GraphNr != -1) // if already discovered, step on
-        DFS.Root = DFS.Root->next;
+    while ((iter != end()) && ((*iter)->GraphNr != -1)) {
+      //Log() << Verbose(1) << "Current next subgraph root candidate is " << (*iter)->Name << "." << endl;
+      if ((*iter)->GraphNr != -1) // if already discovered, step on
+        iter++;
     }
   }
@@ -573,12 +605,11 @@
 {
   NoCyclicBonds = 0;
-  bond *Binder = first;
-  while (Binder->next != last) {
-    Binder = Binder->next;
-    if (Binder->rightatom->LowpointNr == Binder->leftatom->LowpointNr) { // cyclic ??
-      Binder->Cyclic = true;
-      NoCyclicBonds++;
-    }
-  }
+  for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
+    for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
+      if ((*BondRunner)->leftatom == *AtomRunner)
+        if ((*BondRunner)->rightatom->LowpointNr == (*BondRunner)->leftatom->LowpointNr) { // cyclic ??
+          (*BondRunner)->Cyclic = true;
+          NoCyclicBonds++;
+        }
 }
 ;
@@ -599,18 +630,20 @@
 void molecule::OutputGraphInfoPerBond() const
 {
+  bond *Binder = NULL;
   DoLog(1) && (Log() << Verbose(1) << "Final graph info for each bond is:" << endl);
-  bond *Binder = first;
-  while (Binder->next != last) {
-    Binder = Binder->next;
-    DoLog(2) && (Log() << Verbose(2) << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <");
-    DoLog(0) && (Log() << Verbose(0) << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp.");
-    Binder->leftatom->OutputComponentNumber();
-    DoLog(0) && (Log() << Verbose(0) << " ===  ");
-    DoLog(0) && (Log() << Verbose(0) << ((Binder->rightatom->SeparationVertex) ? "SP," : "") << "L" << Binder->rightatom->LowpointNr << " G" << Binder->rightatom->GraphNr << " Comp.");
-    Binder->rightatom->OutputComponentNumber();
-    DoLog(0) && (Log() << Verbose(0) << ">." << endl);
-    if (Binder->Cyclic) // cyclic ??
-      DoLog(3) && (Log() << Verbose(3) << "Lowpoint at each side are equal: CYCLIC!" << endl);
-  }
+  for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
+    for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
+      if ((*BondRunner)->leftatom == *AtomRunner) {
+        Binder = *BondRunner;
+        DoLog(2) && (Log() << Verbose(2) << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <");
+        DoLog(0) && (Log() << Verbose(0) << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp.");
+        Binder->leftatom->OutputComponentNumber();
+        DoLog(0) && (Log() << Verbose(0) << " ===  ");
+        DoLog(0) && (Log() << Verbose(0) << ((Binder->rightatom->SeparationVertex) ? "SP," : "") << "L" << Binder->rightatom->LowpointNr << " G" << Binder->rightatom->GraphNr << " Comp.");
+        Binder->rightatom->OutputComponentNumber();
+        DoLog(0) && (Log() << Verbose(0) << ">." << endl);
+        if (Binder->Cyclic) // cyclic ??
+          DoLog(3) && (Log() << Verbose(3) << "Lowpoint at each side are equal: CYCLIC!" << endl);
+      }
 }
 ;
@@ -624,11 +657,13 @@
 {
   BFS.AtomCount = AtomCount;
-  BFS.PredecessorList = Calloc<atom*> (AtomCount, "molecule::BreadthFirstSearchAdd_Init: **PredecessorList");
-  BFS.ShortestPathList = Malloc<int> (AtomCount, "molecule::BreadthFirstSearchAdd_Init: *ShortestPathList");
-  BFS.ColorList = Calloc<enum Shading> (AtomCount, "molecule::BreadthFirstSearchAdd_Init: *ColorList");
+  BFS.PredecessorList = new atom*[AtomCount];
+  BFS.ShortestPathList = new int[AtomCount];
+  BFS.ColorList = new enum Shading[AtomCount];
   BFS.BFSStack = new StackClass<atom *> (AtomCount);
 
-  for (int i = AtomCount; i--;)
+  for (int i = AtomCount; i--;) {
     BFS.ShortestPathList[i] = -1;
+    BFS.PredecessorList[i] = 0;
+  }
 };
 
@@ -639,7 +674,7 @@
 void FinalizeBFSAccounting(struct BFSAccounting &BFS)
 {
-  Free(&BFS.PredecessorList);
-  Free(&BFS.ShortestPathList);
-  Free(&BFS.ColorList);
+  delete[](BFS.PredecessorList);
+  delete[](BFS.ShortestPathList);
+  delete[](BFS.ColorList);
   delete (BFS.BFSStack);
   BFS.AtomCount = 0;
@@ -692,5 +727,5 @@
         if (OtherAtom->type->Z != 1) {
 #endif
-        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl);
+        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
         if (BFS.ColorList[OtherAtom->nr] == white) {
           BFS.TouchedStack->Push(OtherAtom);
@@ -698,5 +733,5 @@
           BFS.PredecessorList[OtherAtom->nr] = Walker; // Walker is the predecessor
           BFS.ShortestPathList[OtherAtom->nr] = BFS.ShortestPathList[Walker->nr] + 1;
-          DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl);
+          DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " lightgray, its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl);
           //if (BFS.ShortestPathList[OtherAtom->nr] < MinimumRingSize[Walker->GetTrueFather()->nr]) { // Check for maximum distance
           DoLog(3) && (Log() << Verbose(3) << "Putting OtherAtom into queue." << endl);
@@ -719,5 +754,5 @@
     }
     BFS.ColorList[Walker->nr] = black;
-    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " black." << endl);
     if (OtherAtom == BFS.Root) { // if we have found the root, check whether this cycle wasn't already found beforehand
       // step through predecessor list
@@ -770,10 +805,10 @@
     Walker = BFS.Root;
     while (Walker != BackEdge->rightatom) {
-      DoLog(0) && (Log() << Verbose(0) << Walker->Name << " <-> ");
+      DoLog(0) && (Log() << Verbose(0) << Walker->getName() << " <-> ");
       Walker = BFS.PredecessorList[Walker->nr];
       Walker->GetTrueFather()->IsCyclic = true;
       RingSize++;
     }
-    DoLog(0) && (Log() << Verbose(0) << Walker->Name << "  with a length of " << RingSize << "." << endl << endl);
+    DoLog(0) && (Log() << Verbose(0) << Walker->getName() << "  with a length of " << RingSize << "." << endl << endl);
     // walk through all and set MinimumRingSize
     Walker = BFS.Root;
@@ -854,13 +889,12 @@
   if (MinRingSize != -1) { // if rings are present
     // go over all atoms
-    Root = mol->start;
-    while (Root->next != mol->end) {
-      Root = Root->next;
-
-      if (MinimumRingSize[Root->GetTrueFather()->nr] == mol->AtomCount) { // check whether MinimumRingSize is set, if not BFS to next where it is
+    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+      Root = *iter;
+
+      if (MinimumRingSize[Root->GetTrueFather()->nr] == mol->getAtomCount()) { // check whether MinimumRingSize is set, if not BFS to next where it is
         Walker = Root;
 
         //Log() << Verbose(1) << "---------------------------------------------------------------------------------------------------------" << endl;
-        CyclicStructureAnalysis_BFSToNextCycle(Root, Walker, MinimumRingSize, mol->AtomCount);
+        CyclicStructureAnalysis_BFSToNextCycle(Root, Walker, MinimumRingSize, mol->getAtomCount());
 
       }
@@ -892,5 +926,5 @@
   int MinRingSize = -1;
 
-  InitializeBFSAccounting(BFS, AtomCount);
+  InitializeBFSAccounting(BFS, getAtomCount());
 
   //Log() << Verbose(1) << "Back edge list - ";
@@ -966,9 +1000,8 @@
 void molecule::ResetAllBondsToUnused() const
 {
-  bond *Binder = first;
-  while (Binder->next != last) {
-    Binder = Binder->next;
-    Binder->ResetUsed();
-  }
+  for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
+    for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
+      if ((*BondRunner)->leftatom == *AtomRunner)
+        (*BondRunner)->ResetUsed();
 }
 ;
@@ -1004,12 +1037,12 @@
     line << filename;
   AdjacencyFile.open(line.str().c_str(), ios::out);
-  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... ");
+  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... " << endl);
   if (AdjacencyFile != NULL) {
     AdjacencyFile << "m\tn" << endl;
     ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile);
     AdjacencyFile.close();
-    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
   } else {
-    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line.str() << "." << endl);
     status = false;
   }
@@ -1036,12 +1069,12 @@
     line << filename;
   BondFile.open(line.str().c_str(), ios::out);
-  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... ");
+  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... " << endl);
   if (BondFile != NULL) {
     BondFile << "m\tn" << endl;
     ActOnAllAtoms(&atom::OutputBonds, &BondFile);
     BondFile.close();
-    DoLog(1) && (Log() << Verbose(1) << "done." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
   } else {
-    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line.str() << "." << endl);
     status = false;
   }
@@ -1056,10 +1089,12 @@
   filename << path << "/" << FRAGMENTPREFIX << ADJACENCYFILE;
   File.open(filename.str().c_str(), ios::out);
-  DoLog(1) && (Log() << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... ");
+  DoLog(1) && (Log() << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... " << endl);
   if (File == NULL)
     return false;
 
   // allocate storage structure
-  CurrentBonds = Calloc<int> (8, "molecule::CheckAdjacencyFileAgainstMolecule - CurrentBonds"); // contains parsed bonds of current atom
+  CurrentBonds = new int[8]; // contains parsed bonds of current atom
+  for(int i=0;i<8;i++)
+    CurrentBonds[i] = 0;
   return true;
 }
@@ -1070,5 +1105,5 @@
   File.close();
   File.clear();
-  Free(&CurrentBonds);
+  delete[](CurrentBonds);
 }
 ;
@@ -1090,7 +1125,7 @@
         NonMatchNumber++;
         status = false;
+        DoeLog(2) && (eLog() << Verbose(2) << id << " can not be found in list." << endl);
+      } else {
         //Log() << Verbose(0) << "[" << id << "]\t";
-      } else {
-        //Log() << Verbose(0) << id << "\t";
       }
     }
@@ -1114,8 +1149,8 @@
   bool status = true;
   atom *Walker = NULL;
-  char *buffer = NULL;
   int *CurrentBonds = NULL;
   int NonMatchNumber = 0; // will number of atoms with differing bond structure
   size_t CurrentBondsOfAtom = -1;
+  const int AtomCount = getAtomCount();
 
   if (!CheckAdjacencyFileAgainstMolecule_Init(path, File, CurrentBonds)) {
@@ -1124,5 +1159,5 @@
   }
 
-  buffer = Malloc<char> (MAXSTRINGSIZE, "molecule::CheckAdjacencyFileAgainstMolecule: *buffer");
+  char buffer[MAXSTRINGSIZE];
   // Parse the file line by line and count the bonds
   while (!File.eof()) {
@@ -1140,7 +1175,9 @@
       // compare against present bonds
       CheckAdjacencyFileAgainstMolecule_CompareBonds(status, NonMatchNumber, Walker, CurrentBondsOfAtom, AtomNr, CurrentBonds, ListOfAtoms);
-    }
-  }
-  Free(&buffer);
+    } else {
+      if (AtomNr != -1)
+        DoeLog(2) && (eLog() << Verbose(2) << AtomNr << " is not valid in the range of ids [" << 0 << "," << AtomCount << ")." << endl);
+    }
+  }
   CheckAdjacencyFileAgainstMolecule_Finalize(File, CurrentBonds);
 
@@ -1196,7 +1233,7 @@
   BFS.AtomCount = AtomCount;
   BFS.BondOrder = BondOrder;
-  BFS.PredecessorList = Calloc<atom*> (AtomCount, "molecule::BreadthFirstSearchAdd_Init: **PredecessorList");
-  BFS.ShortestPathList = Calloc<int> (AtomCount, "molecule::BreadthFirstSearchAdd_Init: *ShortestPathList");
-  BFS.ColorList = Malloc<enum Shading> (AtomCount, "molecule::BreadthFirstSearchAdd_Init: *ColorList");
+  BFS.PredecessorList = new atom*[AtomCount];
+  BFS.ShortestPathList = new int[AtomCount];
+  BFS.ColorList = new enum Shading[AtomCount];
   BFS.BFSStack = new StackClass<atom *> (AtomCount);
 
@@ -1207,4 +1244,5 @@
   // initialise each vertex as white with no predecessor, empty queue, color Root lightgray
   for (int i = AtomCount; i--;) {
+    BFS.PredecessorList[i] = NULL;
     BFS.ShortestPathList[i] = -1;
     if ((AddedAtomList != NULL) && (AddedAtomList[i] != NULL)) // mark already present atoms (i.e. Root and maybe others) as visited
@@ -1213,5 +1251,5 @@
       BFS.ColorList[i] = white;
   }
-  //BFS.ShortestPathList[Root->nr] = 0; //is set due to Calloc()
+  //BFS.ShortestPathList[Root->nr] = 0; // done by Calloc
 }
 ;
@@ -1219,7 +1257,7 @@
 void BreadthFirstSearchAdd_Free(struct BFSAccounting &BFS)
 {
-  Free(&BFS.PredecessorList);
-  Free(&BFS.ShortestPathList);
-  Free(&BFS.ColorList);
+  delete[](BFS.PredecessorList);
+  delete[](BFS.ShortestPathList);
+  delete[](BFS.ColorList);
   delete (BFS.BFSStack);
   BFS.AtomCount = 0;
@@ -1233,14 +1271,14 @@
   BFS.PredecessorList[OtherAtom->nr] = Walker; // Walker is the predecessor
   BFS.ShortestPathList[OtherAtom->nr] = BFS.ShortestPathList[Walker->nr] + 1;
-  DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " " << ((BFS.ColorList[OtherAtom->nr] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->Name << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl);
+  DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " " << ((BFS.ColorList[OtherAtom->nr] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl);
   if ((((BFS.ShortestPathList[OtherAtom->nr] < BFS.BondOrder) && (Binder != Bond)))) { // Check for maximum distance
     DoLog(3) && (Log() << Verbose(3));
     if (AddedAtomList[OtherAtom->nr] == NULL) { // add if it's not been so far
       AddedAtomList[OtherAtom->nr] = Mol->AddCopyAtom(OtherAtom);
-      DoLog(0) && (Log() << Verbose(0) << "Added OtherAtom " << OtherAtom->Name);
+      DoLog(0) && (Log() << Verbose(0) << "Added OtherAtom " << OtherAtom->getName());
       AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->nr], AddedAtomList[OtherAtom->nr], Binder);
       DoLog(0) && (Log() << Verbose(0) << " and bond " << *(AddedBondList[Binder->nr]) << ", ");
     } else { // this code should actually never come into play (all white atoms are not yet present in BondMolecule, that's why they are white in the first place)
-      DoLog(0) && (Log() << Verbose(0) << "Not adding OtherAtom " << OtherAtom->Name);
+      DoLog(0) && (Log() << Verbose(0) << "Not adding OtherAtom " << OtherAtom->getName());
       if (AddedBondList[Binder->nr] == NULL) {
         AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->nr], AddedAtomList[OtherAtom->nr], Binder);
@@ -1313,5 +1351,5 @@
     AddedAtomList[Root->nr] = Mol->AddCopyAtom(Root);
 
-  BreadthFirstSearchAdd_Init(BFS, Root, BondOrder, AtomCount, AddedAtomList);
+  BreadthFirstSearchAdd_Init(BFS, Root, BondOrder, getAtomCount(), AddedAtomList);
 
   // and go on ... Queue always contains all lightgray vertices
@@ -1322,10 +1360,10 @@
     // followed by n+1 till top of stack.
     Walker = BFS.BFSStack->PopFirst(); // pop oldest added
-    DoLog(1) && (Log() << Verbose(1) << "Current Walker is: " << Walker->Name << ", and has " << Walker->ListOfBonds.size() << " bonds." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "Current Walker is: " << Walker->getName() << ", and has " << Walker->ListOfBonds.size() << " bonds." << endl);
     for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
       if ((*Runner) != NULL) { // don't look at bond equal NULL
         Binder = (*Runner);
         OtherAtom = (*Runner)->GetOtherAtom(Walker);
-        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *(*Runner) << "." << endl);
+        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
         if (BFS.ColorList[OtherAtom->nr] == white) {
           BreadthFirstSearchAdd_UnvisitedNode(Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem);
@@ -1336,5 +1374,5 @@
     }
     BFS.ColorList[Walker->nr] = black;
-    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " black." << endl);
   }
   BreadthFirstSearchAdd_Free(BFS);
@@ -1360,5 +1398,7 @@
 {
   // reset parent list
-  ParentList = Calloc<atom*> (AtomCount, "molecule::BuildInducedSubgraph_Init: **ParentList");
+  ParentList = new atom*[AtomCount];
+  for (int i=0;i<AtomCount;i++)
+    ParentList[i] = NULL;
   DoLog(3) && (Log() << Verbose(3) << "Resetting ParentList." << endl);
 }
@@ -1369,18 +1409,14 @@
   // fill parent list with sons
   DoLog(3) && (Log() << Verbose(3) << "Filling Parent List." << endl);
-  atom *Walker = mol->start;
-  while (Walker->next != mol->end) {
-    Walker = Walker->next;
-    ParentList[Walker->father->nr] = Walker;
+  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    ParentList[(*iter)->father->nr] = (*iter);
     // Outputting List for debugging
-    DoLog(4) && (Log() << Verbose(4) << "Son[" << Walker->father->nr << "] of " << Walker->father << " is " << ParentList[Walker->father->nr] << "." << endl);
-  }
-
-}
-;
+    DoLog(4) && (Log() << Verbose(4) << "Son[" << (*iter)->father->nr << "] of " << (*iter)->father << " is " << ParentList[(*iter)->father->nr] << "." << endl);
+  }
+};
 
 void BuildInducedSubgraph_Finalize(atom **&ParentList)
 {
-  Free(&ParentList);
+  delete[](ParentList);
 }
 ;
@@ -1389,20 +1425,17 @@
 {
   bool status = true;
-  atom *Walker = NULL;
   atom *OtherAtom = NULL;
   // check each entry of parent list and if ok (one-to-and-onto matching) create bonds
   DoLog(3) && (Log() << Verbose(3) << "Creating bonds." << endl);
-  Walker = Father->start;
-  while (Walker->next != Father->end) {
-    Walker = Walker->next;
-    if (ParentList[Walker->nr] != NULL) {
-      if (ParentList[Walker->nr]->father != Walker) {
+  for (molecule::const_iterator iter = Father->begin(); iter != Father->end(); ++iter) {
+    if (ParentList[(*iter)->nr] != NULL) {
+      if (ParentList[(*iter)->nr]->father != (*iter)) {
         status = false;
       } else {
-        for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
-          OtherAtom = (*Runner)->GetOtherAtom(Walker);
+        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
+          OtherAtom = (*Runner)->GetOtherAtom((*iter));
           if (ParentList[OtherAtom->nr] != NULL) { // if otheratom is also a father of an atom on this molecule, create the bond
-            DoLog(4) && (Log() << Verbose(4) << "Endpoints of Bond " << (*Runner) << " are both present: " << ParentList[Walker->nr]->Name << " and " << ParentList[OtherAtom->nr]->Name << "." << endl);
-            mol->AddBond(ParentList[Walker->nr], ParentList[OtherAtom->nr], (*Runner)->BondDegree);
+            DoLog(4) && (Log() << Verbose(4) << "Endpoints of Bond " << (*Runner) << " are both present: " << ParentList[(*iter)->nr]->getName() << " and " << ParentList[OtherAtom->nr]->getName() << "." << endl);
+            mol->AddBond(ParentList[(*iter)->nr], ParentList[OtherAtom->nr], (*Runner)->BondDegree);
           }
         }
@@ -1427,7 +1460,6 @@
   bool status = true;
   atom **ParentList = NULL;
-
   DoLog(2) && (Log() << Verbose(2) << "Begin of BuildInducedSubgraph." << endl);
-  BuildInducedSubgraph_Init(ParentList, Father->AtomCount);
+  BuildInducedSubgraph_Init(ParentList, Father->getAtomCount());
   BuildInducedSubgraph_FillParentList(this, Father, ParentList);
   status = BuildInducedSubgraph_CreateBondsFromParent(this, Father, ParentList);
Index: src/molecule_pointcloud.cpp
===================================================================
--- src/molecule_pointcloud.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/molecule_pointcloud.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -8,4 +8,5 @@
 #include "atom.hpp"
 #include "config.hpp"
+#include "info.hpp"
 #include "memoryallocator.hpp"
 #include "molecule.hpp"
@@ -31,76 +32,47 @@
 };
 
-/** Return current atom in the list.
- * \return pointer to atom or NULL if none present
+
+/** PointCloud implementation of GoPoint
+ * Uses atoms and STL stuff.
  */
-TesselPoint *molecule::GetPoint() const
+TesselPoint* molecule::GetPoint() const
 {
-  if ((InternalPointer != start) && (InternalPointer != end))
-    return InternalPointer;
-  else
-    return NULL;
+  return (*InternalPointer);
 };
 
-/** Return pointer to one after last atom in the list.
- * \return pointer to end marker
- */
-TesselPoint *molecule::GetTerminalPoint() const
-{
-  return end;
-};
-
-/** Return the greatest index of all atoms in the list.
- * \return greatest index
- */
-int molecule::GetMaxId() const
-{
-  return last_atom;
-};
-
-/** Go to next atom.
- * Stops at last one.
+/** PointCloud implementation of GoToNext.
+ * Uses atoms and STL stuff.
  */
 void molecule::GoToNext() const
 {
-  if (InternalPointer != end)
-    InternalPointer = InternalPointer->next;
+  if (InternalPointer != atoms.end())
+    InternalPointer++;
 };
 
-/** Go to previous atom.
- * Stops at first one.
- */
-void molecule::GoToPrevious() const
-{
-  if (InternalPointer->previous != start)
-    InternalPointer = InternalPointer->previous;
-};
-
-/** Goes to first atom.
+/** PointCloud implementation of GoToFirst.
+ * Uses atoms and STL stuff.
  */
 void molecule::GoToFirst() const
 {
-  InternalPointer = start->next;
+  InternalPointer = atoms.begin();
 };
 
-/** Goes to last atom.
- */
-void molecule::GoToLast() const
-{
-  InternalPointer = end->previous;
-};
-
-/** Checks whether we have any atoms in molecule.
- * \return true - no atoms, false - not empty
+/** PointCloud implementation of IsEmpty.
+ * Uses atoms and STL stuff.
  */
 bool molecule::IsEmpty() const
 {
-  return (start->next == end);
+  return (empty());
 };
 
-/** Checks whether we are at the last atom
- * \return true - current atom is last one, false - is not last one
+/** PointCloud implementation of IsLast.
+ * Uses atoms and STL stuff.
  */
 bool molecule::IsEnd() const
 {
-  return (InternalPointer == end);
+  return (InternalPointer == atoms.end());
 };
+
+int molecule::GetMaxId() const {
+  return getAtomCount();
+}
Index: src/molecule_template.hpp
===================================================================
--- src/molecule_template.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/molecule_template.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -24,16 +24,12 @@
 template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() ) const
     {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)();
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)();
   }
 };
 template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() const ) const
     {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)();
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)();
   }
 };
@@ -41,32 +37,24 @@
 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)(t);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)(t);
   }
 };
 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)(t);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)(t);
   }
 };
 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T&), T &t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)(t);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)(t);
   }
 };
 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T&) const, T &t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)(t);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)(t);
   }
 };
@@ -74,16 +62,12 @@
 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)(t, u);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)(t, u);
   }
 };
 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)(t, u);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)(t, u);
   }
 };
@@ -91,16 +75,12 @@
 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)(t, u, v);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)(t, u, v);
   }
 };
 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    ((Walker->node)->*f)(t, u, v);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (((*iter)->node)->*f)(t, u, v);
   }
 };
@@ -112,8 +92,6 @@
 {
   res result = 0;
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    result += (Walker->*f)();
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    result += ((*iter)->*f)();
   }
   return result;
@@ -122,8 +100,6 @@
 {
   res result = 0;
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    result += (Walker->*f)();
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    result += ((*iter)->*f)();
   }
   return result;
@@ -133,8 +109,6 @@
 {
   res result = 0;
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    result += (Walker->*f)(t);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    result += ((*iter)->*f)(t);
   }
   return result;
@@ -143,8 +117,6 @@
 {
   res result = 0;
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    result += (Walker->*f)(t);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    result += ((*iter)->*f)(t);
   }
   return result;
@@ -157,16 +129,12 @@
 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*f)((*iter));
   }
 };
 template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*f)((*iter));
   }
 };
@@ -177,16 +145,12 @@
 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (copy->*f)((*iter));
   }
 };
 template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (copy->*f)((*iter));
   }
 };
@@ -197,36 +161,28 @@
 template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)())
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)())
+      (copy->*f)((*iter));
   }
 };
 template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () const ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)())
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)())
+      (copy->*f)((*iter));
   }
 };
 template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)())
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)())
+      (copy->*f)((*iter));
   }
 };
 template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) () const ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)())
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)())
+      (copy->*f)((*iter));
   }
 };
@@ -234,36 +190,28 @@
 template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t))
+      (copy->*f)((*iter));
   }
 };
 template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T) const, T t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t))
+      (copy->*f)((*iter));
   }
 };
 template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T), T t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t))
+      (copy->*f)((*iter));
   }
 };
 template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T) const, T t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t))
+      (copy->*f)((*iter));
   }
 };
@@ -271,36 +219,28 @@
 template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t,u))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t,u))
+      (copy->*f)((*iter));
   }
 };
 template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t,u))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t,u))
+      (copy->*f)((*iter));
   }
 };
 template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t,u))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t,u))
+      (copy->*f)((*iter));
   }
 };
 template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t,u))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t,u))
+      (copy->*f)((*iter));
   }
 };
@@ -308,36 +248,28 @@
 template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t,u,v))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t,u,v))
+      (copy->*f)((*iter));
   }
 };
 template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t,u,v))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t,u,v))
+      (copy->*f)((*iter));
   }
 };
 template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t,u,v))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t,u,v))
+      (copy->*f)((*iter));
   }
 };
 template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    if ((Walker->*condition)(t,u,v))
-      (copy->*f)(Walker);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    if (((*iter)->*condition)(t,u,v))
+      (copy->*f)((*iter));
   }
 };
@@ -348,16 +280,12 @@
 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)();
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)();
   }
 };
 template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)();
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)();
   }
 };
@@ -365,16 +293,12 @@
 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)(t);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)(t);
   }
 };
 template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)(t);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)(t);
   }
 };
@@ -382,16 +306,12 @@
 template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)(t, u);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)(t, u);
   }
 };
 template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)(t, u);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)(t, u);
   }
 };
@@ -399,16 +319,12 @@
 template <typename res, typename typ, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V), T t, U u, V v) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)(t, u, v);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)(t, u, v);
   }
 };
 template <typename res, typename typ, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V) const, T t, U u, V v) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)(t, u, v);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)(t, u, v);
   }
 };
@@ -416,16 +332,12 @@
 template <typename res, typename typ, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V, W), T t, U u, V v, W w) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)(t, u, v, w);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)(t, u, v, w);
   }
 };
 template <typename res, typename typ, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V, W) const, T t, U u, V v, W w) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (Walker->*f)(t, u, v, w);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    ((*iter)->*f)(t, u, v, w);
   }
 };
@@ -436,25 +348,19 @@
 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *) ) const
 {
-  atom *Walker = start;
   int inc = 1;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (*Setor) (&array[(Walker->*index)], &inc);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*Setor) (&array[((*iter)->*index)], &inc);
   }
 };
 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T value ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (*Setor) (&array[(Walker->*index)], &value);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*Setor) (&array[((*iter)->*index)], &value);
   }
 };
 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T *value ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (*Setor) (&array[(Walker->*index)], value);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*Setor) (&array[((*iter)->*index)], value);
   }
 };
@@ -462,25 +368,19 @@
 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) const
 {
-  atom *Walker = start;
   int inc = 1;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (*Setor) (&array[(Walker->type->*index)], &inc);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*Setor) (&array[((*iter)->type->*index)], &inc);
   }
 };
 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T value ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (*Setor) (&array[(Walker->type->*index)], &value);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*Setor) (&array[((*iter)->type->*index)], &value);
   }
 };
 template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T *value ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    (*Setor) (&array[(Walker->type->*index)], value);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*Setor) (&array[((*iter)->type->*index)], value);
   }
 };
@@ -488,41 +388,31 @@
 template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    array[(Walker->*index)] = (Walker->*Setor) (Walker->*value);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    array[((*iter)->*index)] = ((*iter)->*Setor) ((*iter)->*value);
   }
 };
 template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ atom::*value ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    array[(Walker->*index)] = (Walker->*Setor) (Walker->*value);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    array[((*iter)->*index)] = ((*iter)->*Setor) ((*iter)->*value);
   }
 };
 template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    array[(Walker->*index)] = (Walker->*Setor) (vect);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    array[((*iter)->*index)] = ((*iter)->*Setor) (vect);
   }
 };
 template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ &vect ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    array[(Walker->*index)] = (Walker->*Setor) (vect);
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    array[((*iter)->*index)] = ((*iter)->*Setor) (vect);
   }
 };
 template <typename T, typename typ, typename typ2> void molecule::SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*value ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    Walker->*value = array[(Walker->*index)];
-    //Log() << Verbose(2) << *Walker << " gets " << (Walker->*value); << endl;
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*iter)->*value = array[((*iter)->*index)];
+    //Log() << Verbose(2) << *(*iter) << " gets " << ((*iter)->*value); << endl;
   }
 };
@@ -530,9 +420,7 @@
 template <typename T, typename typ> void molecule::SetAtomValueToValue ( T value, T typ::*ptr ) const
 {
-  atom *Walker = start;
-  while (Walker->next != end) {
-    Walker = Walker->next;
-    Walker->*ptr = value;
-    //Log() << Verbose(2) << *Walker << " gets " << (Walker->*ptr) << endl;
+  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
+    (*iter)->*ptr = value;
+    //Log() << Verbose(2) << *(*iter) << " gets " << ((*iter)->*ptr) << endl;
   }
 };
Index: src/moleculelist.cpp
===================================================================
--- src/moleculelist.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/moleculelist.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -20,5 +20,7 @@
 #include "memoryallocator.hpp"
 #include "periodentafel.hpp"
-#include "World.hpp"
+#include "Helpers/Assert.hpp"
+
+#include "Helpers/Assert.hpp"
 
 /*********************************** Functions for class MoleculeListClass *************************/
@@ -38,10 +40,7 @@
 MoleculeListClass::~MoleculeListClass()
 {
-  DoLog(3) && (Log() << Verbose(3) << this << ": Freeing ListOfMolcules." << endl);
-  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
-    DoLog(4) && (Log() << Verbose(4) << "ListOfMolecules: Freeing " << *ListRunner << "." << endl);
-    world->destroyMolecule(*ListRunner);
-  }
-  DoLog(4) && (Log() << Verbose(4) << "Freeing ListOfMolecules." << endl);
+  DoLog(4) && (Log() << Verbose(4) << "Clearing ListOfMolecules." << endl);
+  for(MoleculeList::iterator MolRunner = ListOfMolecules.begin(); MolRunner != ListOfMolecules.end(); ++MolRunner)
+    (*MolRunner)->signOff(this);
   ListOfMolecules.clear(); // empty list
 };
@@ -49,5 +48,4 @@
 /** Insert a new molecule into the list and set its number.
  * \param *mol molecule to add to list.
- * \return true - add successful
  */
 void MoleculeListClass::insert(molecule *mol)
@@ -59,4 +57,14 @@
 };
 
+/** Erases a molecule from the list.
+ * \param *mol molecule to add to list.
+ */
+void MoleculeListClass::erase(molecule *mol)
+{
+  OBSERVE;
+  mol->signOff(this);
+  ListOfMolecules.remove(mol);
+};
+
 /** Compare whether two molecules are equal.
  * \param *a molecule one
@@ -69,44 +77,46 @@
   int Count, Counter, aCounter, bCounter;
   int flag;
-  atom *aWalker = NULL;
-  atom *bWalker = NULL;
 
   // sort each atom list and put the numbers into a list, then go through
   //Log() << Verbose(0) << "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "." << endl;
-  if ((**(molecule **) a).AtomCount < (**(molecule **) b).AtomCount) {
+  // Yes those types are awkward... but check it for yourself it checks out this way
+  molecule *const *mol1_ptr= static_cast<molecule *const *>(a);
+  molecule *mol1 = *mol1_ptr;
+  molecule *const *mol2_ptr= static_cast<molecule *const *>(b);
+  molecule *mol2 = *mol2_ptr;
+  if (mol1->getAtomCount() < mol2->getAtomCount()) {
     return -1;
   } else {
-    if ((**(molecule **) a).AtomCount > (**(molecule **) b).AtomCount)
+    if (mol1->getAtomCount() > mol2->getAtomCount())
       return +1;
     else {
-      Count = (**(molecule **) a).AtomCount;
+      Count = mol1->getAtomCount();
       aList = new int[Count];
       bList = new int[Count];
 
       // fill the lists
-      aWalker = (**(molecule **) a).start;
-      bWalker = (**(molecule **) b).start;
       Counter = 0;
       aCounter = 0;
       bCounter = 0;
-      while ((aWalker->next != (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) {
-        aWalker = aWalker->next;
-        bWalker = bWalker->next;
-        if (aWalker->GetTrueFather() == NULL)
+      molecule::const_iterator aiter = mol1->begin();
+      molecule::const_iterator biter = mol2->begin();
+      for (;(aiter != mol1->end()) && (biter != mol2->end());
+          ++aiter, ++biter) {
+        if ((*aiter)->GetTrueFather() == NULL)
           aList[Counter] = Count + (aCounter++);
         else
-          aList[Counter] = aWalker->GetTrueFather()->nr;
-        if (bWalker->GetTrueFather() == NULL)
+          aList[Counter] = (*aiter)->GetTrueFather()->nr;
+        if ((*biter)->GetTrueFather() == NULL)
           bList[Counter] = Count + (bCounter++);
         else
-          bList[Counter] = bWalker->GetTrueFather()->nr;
+          bList[Counter] = (*biter)->GetTrueFather()->nr;
         Counter++;
       }
       // check if AtomCount was for real
       flag = 0;
-      if ((aWalker->next == (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) {
+      if ((aiter == mol1->end()) && (biter != mol2->end())) {
         flag = -1;
       } else {
-        if ((aWalker->next != (**(molecule **) a).end) && (bWalker->next == (**(molecule **) b).end))
+        if ((aiter != mol1->end()) && (biter == mol2->end()))
           flag = 1;
       }
@@ -142,5 +152,4 @@
 void MoleculeListClass::Enumerate(ostream *out)
 {
-  atom *Walker = NULL;
   periodentafel *periode = World::getInstance().getPeriode();
   std::map<atomicNumber_t,unsigned int> counts;
@@ -158,13 +167,11 @@
       // count atoms per element and determine size of bounding sphere
       size=0.;
-      Walker = (*ListRunner)->start;
-      while (Walker->next != (*ListRunner)->end) {
-        Walker = Walker->next;
-        counts[Walker->type->getNumber()]++;
-        if (Walker->x.DistanceSquared(Origin) > size)
-          size = Walker->x.DistanceSquared(Origin);
+      for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
+        counts[(*iter)->type->getNumber()]++;
+        if ((*iter)->x.DistanceSquared(Origin) > size)
+          size = (*iter)->x.DistanceSquared(Origin);
       }
       // output Index, Name, number of atoms, chemical formula
-      (*out) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t";
+      (*out) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->getAtomCount() << "\t";
 
       std::map<atomicNumber_t,unsigned int>::reverse_iterator iter;
@@ -202,11 +209,9 @@
 
   // put all molecules of src into mol
-  atom *Walker = srcmol->start;
-  atom *NextAtom = Walker->next;
-  while (NextAtom != srcmol->end) {
-    Walker = NextAtom;
-    NextAtom = Walker->next;
-    srcmol->UnlinkAtom(Walker);
-    mol->AddAtom(Walker);
+  molecule::iterator runner;
+  for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
+    runner = iter++;
+    srcmol->UnlinkAtom((*runner));
+    mol->AddAtom((*runner));
   }
 
@@ -228,10 +233,7 @@
 
   // put all molecules of src into mol
-  atom *Walker = srcmol->start;
-  atom *NextAtom = Walker->next;
-  while (NextAtom != srcmol->end) {
-    Walker = NextAtom;
-    NextAtom = Walker->next;
-    Walker = mol->AddCopyAtom(Walker);
+  atom *Walker = NULL;
+  for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
+    Walker = mol->AddCopyAtom((*iter));
     Walker->father = Walker;
   }
@@ -330,18 +332,15 @@
 
   // prepare index list for bonds
-  srcmol->CountAtoms();
-  atom ** CopyAtoms = new atom*[srcmol->AtomCount];
-  for(int i=0;i<srcmol->AtomCount;i++)
+  atom ** CopyAtoms = new atom*[srcmol->getAtomCount()];
+  for(int i=0;i<srcmol->getAtomCount();i++)
     CopyAtoms[i] = NULL;
 
   // for each of the source atoms check whether we are in- or outside and add copy atom
-  atom *Walker = srcmol->start;
   int nr=0;
-  while (Walker->next != srcmol->end) {
-    Walker = Walker->next;
-    DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << *Walker << "." << endl);
-    if (!TesselStruct->IsInnerPoint(Walker->x, LCList)) {
-      CopyAtoms[Walker->nr] = Walker->clone();
-      mol->AddAtom(CopyAtoms[Walker->nr]);
+  for (molecule::const_iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
+    DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << **iter << "." << endl);
+    if (!TesselStruct->IsInnerPoint((*iter)->x, LCList)) {
+      CopyAtoms[(*iter)->nr] = (*iter)->clone();
+      mol->AddAtom(CopyAtoms[(*iter)->nr]);
       nr++;
     } else {
@@ -349,13 +348,13 @@
     }
   }
-  DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol->AtomCount << " atoms have been merged.");
+  DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol->getAtomCount() << " atoms have been merged.");
 
   // go through all bonds and add as well
-  bond *Binder = srcmol->first;
-  while(Binder->next != srcmol->last) {
-    Binder = Binder->next;
-    DoLog(3) && (Log() << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->nr] << " and " << *CopyAtoms[Binder->rightatom->nr]<< "." << endl);
-    mol->AddBond(CopyAtoms[Binder->leftatom->nr], CopyAtoms[Binder->rightatom->nr], Binder->BondDegree);
-  }
+  for(molecule::iterator AtomRunner = srcmol->begin(); AtomRunner != srcmol->end(); ++AtomRunner)
+    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
+      if ((*BondRunner)->leftatom == *AtomRunner) {
+        DoLog(3) && (Log() << Verbose(3) << "Adding Bond between " << *CopyAtoms[(*BondRunner)->leftatom->nr] << " and " << *CopyAtoms[(*BondRunner)->rightatom->nr]<< "." << endl);
+        mol->AddBond(CopyAtoms[(*BondRunner)->leftatom->nr], CopyAtoms[(*BondRunner)->rightatom->nr], (*BondRunner)->BondDegree);
+      }
   delete(LCList);
   return true;
@@ -382,6 +381,4 @@
 bool MoleculeListClass::AddHydrogenCorrection(char *path)
 {
-  atom *Walker = NULL;
-  atom *Runner = NULL;
   bond *Binder = NULL;
   double ***FitConstant = NULL, **correction = NULL;
@@ -427,9 +424,12 @@
 
   // 0b. allocate memory for constants
-  FitConstant = Calloc<double**>(3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
+  FitConstant = new double**[3];
   for (int k = 0; k < 3; k++) {
-    FitConstant[k] = Calloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
+    FitConstant[k] = new double*[a];
     for (int i = a; i--;) {
-      FitConstant[k][i] = Calloc<double>(b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
+      FitConstant[k][i] = new double[b];
+      for (int j = b; j--;) {
+        FitConstant[k][i][j] = 0.;
+      }
     }
   }
@@ -477,7 +477,7 @@
 
   // 0d. allocate final correction matrix
-  correction = Calloc<double*>(a, "MoleculeListClass::AddHydrogenCorrection: **correction");
+  correction = new double*[a];
   for (int i = a; i--;)
-    correction[i] = Calloc<double>(b, "MoleculeListClass::AddHydrogenCorrection: *correction[]");
+    correction[i] = new double[b];
 
   // 1a. go through every molecule in the list
@@ -488,20 +488,16 @@
         correction[k][j] = 0.;
     // 2. take every hydrogen that is a saturated one
-    Walker = (*ListRunner)->start;
-    while (Walker->next != (*ListRunner)->end) {
-      Walker = Walker->next;
-      //Log() << Verbose(1) << "Walker: " << *Walker << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl;
-      if ((Walker->type->Z == 1) && ((Walker->father == NULL)
-          || (Walker->father->type->Z != 1))) { // if it's a hydrogen
-        Runner = (*ListRunner)->start;
-        while (Runner->next != (*ListRunner)->end) {
-          Runner = Runner->next;
-          //Log() << Verbose(2) << "Runner: " << *Runner << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl;
+    for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
+      //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
+      if (((*iter)->type->Z == 1) && (((*iter)->father == NULL)
+          || ((*iter)->father->type->Z != 1))) { // if it's a hydrogen
+        for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) {
+          //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
           // 3. take every other hydrogen that is the not the first and not bound to same bonding partner
-          Binder = *(Runner->ListOfBonds.begin());
-          if ((Runner->type->Z == 1) && (Runner->nr > Walker->nr) && (Binder->GetOtherAtom(Runner) != Binder->GetOtherAtom(Walker))) { // (hydrogens have only one bonding partner!)
+          Binder = *((*runner)->ListOfBonds.begin());
+          if (((*runner)->type->Z == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
             // 4. evaluate the morse potential for each matrix component and add up
-            distance = Runner->x.distance(Walker->x);
-            //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *Runner << "<= " << distance << "=>" << *Walker << ":" << endl;
+            distance = (*runner)->x.distance((*iter)->x);
+            //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":" << endl;
             for (int k = 0; k < a; k++) {
               for (int j = 0; j < b; j++) {
@@ -531,5 +527,5 @@
     FragmentNumber = FixedDigitNumber(ListOfMolecules.size(), (*ListRunner)->IndexNr);
     line += FragmentNumber;
-    delete (FragmentNumber);
+    delete[] (FragmentNumber);
     line += HCORRECTIONSUFFIX;
     output.open(line.c_str());
@@ -542,4 +538,8 @@
     output.close();
   }
+  for (int i = a; i--;)
+    delete[](correction[i]);
+  delete[](correction);
+
   line = path;
   line.append("/");
@@ -556,9 +556,9 @@
   for (int k = 0; k < 3; k++) {
     for (int i = a; i--;) {
-      Free(&FitConstant[k][i]);
-    }
-    Free(&FitConstant[k]);
-  }
-  Free(&FitConstant);
+      delete[](FitConstant[k][i]);
+    }
+    delete[](FitConstant[k]);
+  }
+  delete[](FitConstant);
   DoLog(0) && (Log() << Verbose(0) << "done." << endl);
   return true;
@@ -577,5 +577,4 @@
   ofstream ForcesFile;
   stringstream line;
-  atom *Walker = NULL;
   periodentafel *periode=World::getInstance().getPeriode();
 
@@ -590,12 +589,10 @@
       periodentafel::const_iterator elemIter;
       for(elemIter=periode->begin();elemIter!=periode->end();++elemIter){
-          if ((*ListRunner)->ElementsInMolecule[(*elemIter).first]) { // if this element got atoms
-          Walker = (*ListRunner)->start;
-          while (Walker->next != (*ListRunner)->end) { // go through every atom of this element
-            Walker = Walker->next;
-            if (Walker->type->getNumber() == (*elemIter).first) {
-              if ((Walker->GetTrueFather() != NULL) && (Walker->GetTrueFather() != Walker)) {// if there is a rea
+        if ((*ListRunner)->ElementsInMolecule[(*elemIter).first]) { // if this element got atoms
+          for(molecule::iterator atomIter = (*ListRunner)->begin(); atomIter !=(*ListRunner)->end();++atomIter){
+            if ((*atomIter)->type->getNumber() == (*elemIter).first) {
+              if (((*atomIter)->GetTrueFather() != NULL) && ((*atomIter)->GetTrueFather() != (*atomIter))) {// if there is a rea
                 //Log() << Verbose(0) << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it
-                ForcesFile << SortIndex[Walker->GetTrueFather()->nr] << "\t";
+                ForcesFile << SortIndex[(*atomIter)->GetTrueFather()->nr] << "\t";
               } else
                 // otherwise a -1 to indicate an added saturation hydrogen
@@ -622,6 +619,4 @@
  * \param *configuration standard configuration to attach atoms in fragment molecule to.
  * \param *SortIndex Index to map from the BFS labeling to the sequence how of Ion_Type in the config
- * \param DoPeriodic true - call ScanForPeriodicCorrection, false - don't
- * \param DoCentering true - call molecule::CenterEdge(), false - don't
  * \return true - success (each file was written), false - something went wrong.
  */
@@ -633,5 +628,4 @@
   bool result = true;
   bool intermediateResult = true;
-  atom *Walker = NULL;
   Vector BoxDimension;
   char *FragmentNumber = NULL;
@@ -674,8 +668,6 @@
     // list atoms in fragment for debugging
     DoLog(2) && (Log() << Verbose(2) << "Contained atoms: ");
-    Walker = (*ListRunner)->start;
-    while (Walker->next != (*ListRunner)->end) {
-      Walker = Walker->next;
-      DoLog(0) && (Log() << Verbose(0) << Walker->Name << " ");
+    for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
+      DoLog(0) && (Log() << Verbose(0) << (*iter)->getName() << " ");
     }
     DoLog(0) && (Log() << Verbose(0) << endl);
@@ -724,5 +716,5 @@
     //outputFragment.close();
     //outputFragment.clear();
-    Free(&FragmentNumber);
+    delete[](FragmentNumber);
   }
   DoLog(0) && (Log() << Verbose(0) << " done." << endl);
@@ -756,31 +748,17 @@
 void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration)
 {
+  // 0a. remove all present molecules
+  vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
+  for (vector<molecule *>::iterator MolRunner = allmolecules.begin(); MolRunner != allmolecules.end(); ++MolRunner) {
+    erase(*MolRunner);
+    World::getInstance().destroyMolecule(*MolRunner);
+  }
+  // 0b. remove all bonds and construct a molecule with all atoms
   molecule *mol = World::getInstance().createMolecule();
-  atom *Walker = NULL;
-  atom *Advancer = NULL;
-  bond *Binder = NULL;
-  bond *Stepper = NULL;
-  // 0. gather all atoms into single molecule
-  for (MoleculeList::iterator MolRunner = ListOfMolecules.begin(); !ListOfMolecules.empty(); MolRunner = ListOfMolecules.begin()) {
-    // shift all atoms to new molecule
-    Advancer = (*MolRunner)->start->next;
-    while (Advancer != (*MolRunner)->end) {
-      Walker = Advancer;
-      Advancer = Advancer->next;
-      DoLog(3) && (Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl);
-      unlink(Walker);
-      Walker->father = Walker;
-      mol->AddAtom(Walker);    // counting starts at 1
-    }
-    // remove all bonds
-    Stepper = (*MolRunner)->first->next;
-    while (Stepper != (*MolRunner)->last) {
-      Binder = Stepper;
-      Stepper = Stepper->next;
-      delete(Binder);
-    }
-    // remove the molecule
-    World::getInstance().destroyMolecule(*MolRunner);
-    ListOfMolecules.erase(MolRunner);
+  vector <atom *> allatoms = World::getInstance().getAllAtoms();
+  for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
+    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
+      delete(*BondRunner);
+    mol->AddAtom(*AtomRunner);
   }
 
@@ -810,6 +788,8 @@
   const int MolCount = Subgraphs->next->Count();
   char number[MAXSTRINGSIZE];
-  molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules");
+  molecule **molecules = new molecule *[MolCount];
+  MoleculeLeafClass *MolecularWalker = Subgraphs;
   for (int i=0;i<MolCount;i++) {
+    MolecularWalker = MolecularWalker->next;
     molecules[i] = World::getInstance().createMolecule();
     molecules[i]->ActiveFlag = true;
@@ -820,4 +800,7 @@
     }
     DoLog(1) && (Log() << Verbose(1) << "MolName is " << molecules[i]->name << endl);
+    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) {
+      DoLog(1) && (Log() << Verbose(1) << **iter << endl);
+    }
     insert(molecules[i]);
   }
@@ -825,43 +808,20 @@
   // 4b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1)
   int FragmentCounter = 0;
-  int *MolMap = Calloc<int>(mol->AtomCount, "config::Load() - *MolMap");
-  MoleculeLeafClass *MolecularWalker = Subgraphs;
-  Walker = NULL;
+  map<int, atom *> AtomToFragmentMap;
+  MolecularWalker = Subgraphs;
   while (MolecularWalker->next != NULL) {
     MolecularWalker = MolecularWalker->next;
-    Walker = MolecularWalker->Leaf->start;
-    while (Walker->next != MolecularWalker->Leaf->end) {
-      Walker = Walker->next;
-      MolMap[Walker->GetTrueFather()->nr] = FragmentCounter+1;
+    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); !MolecularWalker->Leaf->empty(); iter = MolecularWalker->Leaf->begin()) {
+      atom * Walker = *iter;
+      DoLog(1) && (Log() << Verbose(1) << "Re-linking " << Walker << "..." << endl);
+      MolecularWalker->Leaf->erase(iter);
+      molecules[FragmentCounter]->AddAtom(Walker);    // counting starts at 1
     }
     FragmentCounter++;
   }
-
-  // 4c. relocate atoms to new molecules and remove from Leafs
-  Walker = NULL;
-  while (mol->start->next != mol->end) {
-    Walker = mol->start->next;
-    if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) {
-      DoeLog(0) && (eLog()<< Verbose(0) << "Index of atom " << *Walker << " is invalid!" << endl);
-      performCriticalExit();
-    }
-    FragmentCounter = MolMap[Walker->nr];
-    if (FragmentCounter != 0) {
-      DoLog(3) && (Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl);
-      unlink(Walker);
-      molecules[FragmentCounter-1]->AddAtom(Walker);    // counting starts at 1
-    } else {
-      DoeLog(0) && (eLog()<< Verbose(0) << "Atom " << *Walker << " not associated to molecule!" << endl);
-      performCriticalExit();
-    }
-  }
+  World::getInstance().destroyMolecule(mol);
+
   // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list
-  Binder = mol->first;
-  while (mol->first->next != mol->last) {
-    Binder = mol->first->next;
-    Walker = Binder->leftatom;
-    unlink(Binder);
-    link(Binder,molecules[MolMap[Walker->nr]-1]->last);   // counting starts at 1
-  }
+  // TODO: check whether this is really not needed anymore
   // 4e. free Leafs
   MolecularWalker = Subgraphs;
@@ -871,6 +831,5 @@
   }
   delete(MolecularWalker);
-  Free(&MolMap);
-  Free(&molecules);
+  delete[](molecules);
   DoLog(1) && (Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl);
 };
@@ -882,12 +841,7 @@
 int MoleculeListClass::CountAllAtoms() const
 {
-  atom *Walker = NULL;
   int AtomNo = 0;
   for (MoleculeList::const_iterator MolWalker = ListOfMolecules.begin(); MolWalker != ListOfMolecules.end(); MolWalker++) {
-    Walker = (*MolWalker)->start;
-    while (Walker->next != (*MolWalker)->end) {
-      Walker = Walker->next;
-      AtomNo++;
-    }
+    AtomNo += (*MolWalker)->size();
   }
   return AtomNo;
@@ -1064,5 +1018,4 @@
 bool MoleculeLeafClass::FillBondStructureFromReference(const molecule * const reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList)
 {
-  atom *Walker = NULL;
   atom *OtherWalker = NULL;
   atom *Father = NULL;
@@ -1072,5 +1025,5 @@
   DoLog(1) && (Log() << Verbose(1) << "Begin of FillBondStructureFromReference." << endl);
   // fill ListOfLocalAtoms if NULL was given
-  if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {
+  if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->getAtomCount(), FreeList)) {
     DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl);
     return false;
@@ -1080,24 +1033,19 @@
     DoLog(1) && (Log() << Verbose(1) << "Creating adjacency list for subgraph " << Leaf << "." << endl);
     // remove every bond from the list
-    bond *Binder = NULL;
-    while (Leaf->last->previous != Leaf->first) {
-      Binder = Leaf->last->previous;
-      Binder->leftatom->UnregisterBond(Binder);
-      Binder->rightatom->UnregisterBond(Binder);
-      removewithoutcheck(Binder);
-    }
-
-    Walker = Leaf->start;
-    while (Walker->next != Leaf->end) {
-      Walker = Walker->next;
-      Father = Walker->GetTrueFather();
+    for(molecule::iterator AtomRunner = Leaf->begin(); AtomRunner != Leaf->end(); ++AtomRunner)
+      for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
+        if ((*BondRunner)->leftatom == *AtomRunner)
+          delete((*BondRunner));
+
+    for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) {
+      Father = (*iter)->GetTrueFather();
       AtomNo = Father->nr; // global id of the current walker
       for (BondList::const_iterator Runner = Father->ListOfBonds.begin(); Runner != Father->ListOfBonds.end(); (++Runner)) {
-        OtherWalker = ListOfLocalAtoms[FragmentCounter][(*Runner)->GetOtherAtom(Walker->GetTrueFather())->nr]; // local copy of current bond partner of walker
+        OtherWalker = ListOfLocalAtoms[FragmentCounter][(*Runner)->GetOtherAtom((*iter)->GetTrueFather())->nr]; // local copy of current bond partner of walker
         if (OtherWalker != NULL) {
-          if (OtherWalker->nr > Walker->nr)
-            Leaf->AddBond(Walker, OtherWalker, (*Runner)->BondDegree);
+          if (OtherWalker->nr > (*iter)->nr)
+            Leaf->AddBond((*iter), OtherWalker, (*Runner)->BondDegree);
         } else {
-          DoLog(1) && (Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom(Walker->GetTrueFather())->nr << "] is NULL!" << endl);
+          DoLog(1) && (Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom((*iter)->GetTrueFather())->nr << "] is NULL!" << endl);
           status = false;
         }
@@ -1108,7 +1056,7 @@
   if ((FreeList) && (ListOfLocalAtoms != NULL)) {
     // free the index lookup list
-    Free(&ListOfLocalAtoms[FragmentCounter]);
+    delete[](ListOfLocalAtoms[FragmentCounter]);
     if (FragmentCounter == 0) // first fragments frees the initial pointer to list
-      Free(&ListOfLocalAtoms);
+      delete[](ListOfLocalAtoms);
   }
   DoLog(1) && (Log() << Verbose(1) << "End of FillBondStructureFromReference." << endl);
@@ -1126,5 +1074,5 @@
 bool MoleculeLeafClass::FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter)
 {
-  atom *Walker = NULL, *Father = NULL;
+  atom *Father = NULL;
 
   if (RootStack != NULL) {
@@ -1132,13 +1080,11 @@
     if (&(RootStack[FragmentCounter]) != NULL) {
       RootStack[FragmentCounter].clear();
-      Walker = Leaf->start;
-      while (Walker->next != Leaf->end) { // go through all (non-hydrogen) atoms
-        Walker = Walker->next;
-        Father = Walker->GetTrueFather();
+      for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) {
+        Father = (*iter)->GetTrueFather();
         if (AtomMask[Father->nr]) // apply mask
 #ifdef ADDHYDROGEN
-          if (Walker->type->Z != 1) // skip hydrogen
+          if ((*iter)->type->Z != 1) // skip hydrogen
 #endif
-          RootStack[FragmentCounter].push_front(Walker->nr);
+          RootStack[FragmentCounter].push_front((*iter)->nr);
       }
       if (next != NULL)
@@ -1171,13 +1117,16 @@
     // allocate and set each field to NULL
     const int Counter = Count();
-    ListOfLocalAtoms = Calloc<atom**>(Counter, "MoleculeLeafClass::FillListOfLocalAtoms - ***ListOfLocalAtoms");
+    ASSERT(FragmentCounter < Counter, "FillListOfLocalAtoms: FragmenCounter greater than present fragments.");
+    ListOfLocalAtoms = new atom**[Counter];
     if (ListOfLocalAtoms == NULL) {
       FreeList = FreeList && false;
       status = false;
     }
+    for (int i=0;i<Counter;i++)
+      ListOfLocalAtoms[i] = NULL;
   }
 
   if ((ListOfLocalAtoms != NULL) && (ListOfLocalAtoms[FragmentCounter] == NULL)) { // allocate and fill list of this fragment/subgraph
-    status = status && CreateFatherLookupTable(Leaf->start, Leaf->end, ListOfLocalAtoms[FragmentCounter], GlobalAtomCount);
+    status = status && Leaf->CreateFatherLookupTable(ListOfLocalAtoms[FragmentCounter], GlobalAtomCount);
     FreeList = FreeList && true;
   }
@@ -1203,5 +1152,5 @@
   DoLog(1) && (Log() << Verbose(1) << "Begin of AssignKeySetsToFragment." << endl);
   // fill ListOfLocalAtoms if NULL was given
-  if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {
+  if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->getAtomCount(), FreeList)) {
     DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl);
     return false;
@@ -1211,5 +1160,7 @@
   if (FragmentList == NULL) {
     KeySetCounter = Count();
-    FragmentList = Calloc<Graph*>(KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");
+    FragmentList = new Graph*[KeySetCounter];
+    for (int i=0;i<KeySetCounter;i++)
+      FragmentList[i] = NULL;
     KeySetCounter = 0;
   }
@@ -1245,7 +1196,7 @@
   if ((FreeList) && (ListOfLocalAtoms != NULL)) {
     // free the index lookup list
-    Free(&ListOfLocalAtoms[FragmentCounter]);
+    delete[](ListOfLocalAtoms[FragmentCounter]);
     if (FragmentCounter == 0) // first fragments frees the initial pointer to list
-      Free(&ListOfLocalAtoms);
+      delete[](ListOfLocalAtoms);
   }
   DoLog(1) && (Log() << Verbose(1) << "End of AssignKeySetsToFragment." << endl);
Index: src/parser.cpp
===================================================================
--- src/parser.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/parser.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -32,5 +32,5 @@
   if (input == NULL) {
     if (!test)
-      DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << filename << ", is the directory correct?" << endl);
+      DoLog(0) && (Log() << Verbose(0) << endl << "FilePresent: Unable to open " << filename << ", is the directory correct?" << endl);
     return false;
   }
@@ -59,8 +59,8 @@
 MatrixContainer::MatrixContainer() {
   Indices = NULL;
-  Header = Malloc<char*>(1, "MatrixContainer::MatrixContainer: **Header");
-  Matrix = Malloc<double**>(1, "MatrixContainer::MatrixContainer: ***Matrix"); // one more each for the total molecule
-  RowCounter = Malloc<int>(1, "MatrixContainer::MatrixContainer: *RowCounter");
-  ColumnCounter = Malloc<int>(1, "MatrixContainer::MatrixContainer: *ColumnCounter");
+  Header = new char*[1];
+  Matrix = new double**[1]; // one more each for the total molecule
+  RowCounter = new int[1];
+  ColumnCounter = new int[1];
   Header[0] = NULL;
   Matrix[0] = NULL;
@@ -77,27 +77,27 @@
       if ((ColumnCounter != NULL) && (RowCounter != NULL)) {
           for(int j=RowCounter[i]+1;j--;)
-            Free(&Matrix[i][j]);
-        Free(&Matrix[i]);
+            delete[](Matrix[i][j]);
+          delete[](Matrix[i]);
       }
     }
     if ((ColumnCounter != NULL) && (RowCounter != NULL) && (Matrix[MatrixCounter] != NULL))
       for(int j=RowCounter[MatrixCounter]+1;j--;)
-        Free(&Matrix[MatrixCounter][j]);
+        delete[](Matrix[MatrixCounter][j]);
     if (MatrixCounter != 0)
-      Free(&Matrix[MatrixCounter]);
-    Free(&Matrix);
+      delete[](Matrix[MatrixCounter]);
+    delete[](Matrix);
   }
   if (Indices != NULL)
     for(int i=MatrixCounter+1;i--;) {
-      Free(&Indices[i]);
-    }
-  Free(&Indices);
+      delete[](Indices[i]);
+    }
+  delete[](Indices);
   
   if (Header != NULL)
     for(int i=MatrixCounter+1;i--;)
-      Free(&Header[i]);
-  Free(&Header);
-  Free(&RowCounter);
-  Free(&ColumnCounter);
+      delete[](Header[i]);
+  delete[](Header);
+  delete[](RowCounter);
+  delete[](ColumnCounter);
 };
 
@@ -112,7 +112,7 @@
   if (Matrix == NULL) {
     DoLog(0) && (Log() << Verbose(0) << " with trivial mapping." << endl);
-    Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices");
+    Indices = new int*[MatrixCounter + 1];
     for(int i=MatrixCounter+1;i--;) {
-      Indices[i] = Malloc<int>(RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
+      Indices[i] = new int[RowCounter[i]];
       for(int j=RowCounter[i];j--;)
         Indices[i][j] = j;
@@ -122,9 +122,9 @@
     if (MatrixCounter != Matrix->MatrixCounter)
       return false;
-    Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices");
+    Indices = new int*[MatrixCounter + 1];
     for(int i=MatrixCounter+1;i--;) {
       if (RowCounter[i] != Matrix->RowCounter[i])
         return false;
-      Indices[i] = Malloc<int>(Matrix->RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
+      Indices[i] = new int[Matrix->RowCounter[i]];
       for(int j=Matrix->RowCounter[i];j--;) {
         Indices[i][j] = Matrix->Indices[i][j];
@@ -160,5 +160,5 @@
   //Log() << Verbose(1) << "Opening " << name << " ... "  << input << endl;
   if (input == NULL) {
-    DoeLog(1) && (eLog()<< Verbose(1) << endl << "Unable to open " << name << ", is the directory correct?" << endl);
+    DoeLog(1) && (eLog()<< Verbose(1) << endl << "MatrixContainer::ParseMatrix: Unable to open " << name << ", is the directory correct?" << endl);
     //performCriticalExit();
     return false;
@@ -166,5 +166,5 @@
 
   // parse header
-  Header[MatrixNr] = Malloc<char>(1024, "MatrixContainer::ParseMatrix: *Header[]");
+  Header[MatrixNr] = new char[1024];
   for (int m=skiplines+1;m--;)
     input.getline(Header[MatrixNr], 1023);
@@ -205,5 +205,5 @@
   // allocate matrix if it's not zero dimension in one direction
   if ((ColumnCounter[MatrixNr] > 0) && (RowCounter[MatrixNr] > -1)) {
-    Matrix[MatrixNr] = Malloc<double*>(RowCounter[MatrixNr] + 1, "MatrixContainer::ParseMatrix: **Matrix[]");
+    Matrix[MatrixNr] = new double*[RowCounter[MatrixNr] + 1];
   
     // parse in each entry for this matrix
@@ -217,5 +217,5 @@
     strncpy(Header[MatrixNr], line.str().c_str(), 1023);  
     for(int j=0;j<RowCounter[MatrixNr];j++) {
-      Matrix[MatrixNr][j] = Malloc<double>(ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[][]");
+      Matrix[MatrixNr][j] = new double[ColumnCounter[MatrixNr]];
       input.getline(filename, 1023);
       stringstream lines(filename);
@@ -227,5 +227,5 @@
         //Log() << Verbose(1) << " " << setprecision(2) << Matrix[MatrixNr][j][k] << endl;
       }
-      Matrix[MatrixNr][ RowCounter[MatrixNr] ] = Malloc<double>(ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[RowCounter[MatrixNr]][]");
+      Matrix[MatrixNr][ RowCounter[MatrixNr] ] = new double[ColumnCounter[MatrixNr]];
       for(int j=ColumnCounter[MatrixNr];j--;)
         Matrix[MatrixNr][ RowCounter[MatrixNr] ][j] = 0.;
@@ -269,5 +269,5 @@
   input.open(file.str().c_str(), ios::in);
   if (input == NULL) {
-    DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl);
+    DoLog(0) && (Log() << Verbose(0) << endl << "MatrixContainer::ParseFragmentMatrix: Unable to open " << file.str() << ", is the directory correct?" << endl);
     return false;
   }
@@ -281,8 +281,12 @@
 
   DoLog(0) && (Log() << Verbose(0) << "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl);
-  Header = ReAlloc<char*>(Header, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: **Header"); // one more each for the total molecule
-  Matrix = ReAlloc<double**>(Matrix, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: ***Matrix"); // one more each for the total molecule
-  RowCounter = ReAlloc<int>(RowCounter, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: *RowCounter");
-  ColumnCounter = ReAlloc<int>(ColumnCounter, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: *ColumnCounter");
+  delete[](Header);
+  delete[](Matrix);
+  delete[](RowCounter);
+  delete[](ColumnCounter);
+  Header = new char*[MatrixCounter + 1]; // one more each for the total molecule
+  Matrix = new double**[MatrixCounter + 1]; // one more each for the total molecule
+  RowCounter = new int[MatrixCounter + 1];
+  ColumnCounter = new int[MatrixCounter + 1];
   for(int i=MatrixCounter+1;i--;) {
     Matrix[i] = NULL;
@@ -298,5 +302,5 @@
     if (!ParseMatrix(file.str().c_str(), skiplines, skipcolumns, i))
       return false;
-    Free(&FragmentNumber);
+    delete[](FragmentNumber);
   }
   return true;
@@ -313,16 +317,16 @@
 {
   MatrixCounter = MCounter;
-  Header = Malloc<char*>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: *Header");
-  Matrix = Malloc<double**>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: ***Matrix"); // one more each for the total molecule
-  RowCounter = Malloc<int>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: *RowCounter");
-  ColumnCounter = Malloc<int>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: *ColumnCounter");
+  Header = new char*[MatrixCounter + 1];
+  Matrix = new double**[MatrixCounter + 1]; // one more each for the total molecule
+  RowCounter = new int[MatrixCounter + 1];
+  ColumnCounter = new int[MatrixCounter + 1];
   for(int i=MatrixCounter+1;i--;) {
-    Header[i] = Malloc<char>(1024, "MatrixContainer::AllocateMatrix: *Header[i]");
+    Header[i] = new char[1024];
     strncpy(Header[i], GivenHeader[i], 1023);
     RowCounter[i] = RCounter[i];
     ColumnCounter[i] = CCounter[i];
-    Matrix[i] = Malloc<double*>(RowCounter[i] + 1, "MatrixContainer::AllocateMatrix: **Matrix[]");
+    Matrix[i] = new double*[RowCounter[i] + 1];
     for(int j=RowCounter[i]+1;j--;) {
-      Matrix[i][j] = Malloc<double>(ColumnCounter[i], "MatrixContainer::AllocateMatrix: *Matrix[][]");
+      Matrix[i][j] = new double[ColumnCounter[i]];
       for(int k=ColumnCounter[i];k--;)
         Matrix[i][j][k] = 0.;
@@ -474,8 +478,8 @@
     FragmentNumber = FixedDigitNumber(MatrixCounter, i);
     line << name << FRAGMENTPREFIX << FragmentNumber << "/" << prefix;
-    Free(&FragmentNumber);
+    delete[](FragmentNumber);
     output.open(line.str().c_str(), ios::out);
     if (output == NULL) {
-      DoeLog(0) && (eLog()<< Verbose(0) << "Unable to open output energy file " << line.str() << "!" << endl);
+      DoeLog(0) && (eLog()<< Verbose(0) << "MatrixContainer::WriteTotalFragments: Unable to open output energy file " << line.str() << "!" << endl);
       performCriticalExit();
       return false;
@@ -507,5 +511,5 @@
   output.open(line.str().c_str(), ios::out);
   if (output == NULL) {
-    DoeLog(0) && (eLog()<< Verbose(0) << "Unable to open output matrix file " << line.str() << "!" << endl);
+    DoeLog(0) && (eLog()<< Verbose(0) << "MatrixContainer::WriteLastMatrix: Unable to open output matrix file " << line.str() << "!" << endl);
     performCriticalExit();
     return false;
@@ -530,7 +534,7 @@
 {
   DoLog(0) && (Log() << Verbose(0) << "Parsing energy indices." << endl);
-  Indices = Malloc<int*>(MatrixCounter + 1, "EnergyMatrix::ParseIndices: **Indices");
+  Indices = new int*[MatrixCounter + 1];
   for(int i=MatrixCounter+1;i--;) {
-    Indices[i] = Malloc<int>(RowCounter[i], "EnergyMatrix::ParseIndices: *Indices[]");
+    Indices[i] = new int[RowCounter[i]];
     for(int j=RowCounter[i];j--;)
       Indices[i][j] = j;
@@ -589,7 +593,7 @@
     // allocate last plus one matrix
     DoLog(0) && (Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl);
-    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
+    Matrix[MatrixCounter] = new double*[RowCounter[MatrixCounter] + 1];
     for(int j=0;j<=RowCounter[MatrixCounter];j++)
-      Matrix[MatrixCounter][j] = Malloc<double>(ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
+      Matrix[MatrixCounter][j] = new double[ColumnCounter[MatrixCounter]];
     
     // try independently to parse global energysuffix file if present
@@ -616,10 +620,10 @@
 
   DoLog(0) && (Log() << Verbose(0) << "Parsing force indices for " << MatrixCounter << " matrices." << endl);
-  Indices = Malloc<int*>(MatrixCounter + 1, "ForceMatrix::ParseIndices: **Indices");
+  Indices = new int*[MatrixCounter + 1];
   line << name << FRAGMENTPREFIX << FORCESFILE;
   input.open(line.str().c_str(), ios::in);
   //Log() << Verbose(0) << "Opening " << line.str() << " ... "  << input << endl;
   if (input == NULL) {
-    DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl);
+    DoLog(0) && (Log() << Verbose(0) << endl << "ForceMatrix::ParseIndices: Unable to open " << line.str() << ", is the directory correct?" << endl);
     return false;
   }
@@ -629,8 +633,8 @@
     line.str(filename);
     // parse the values
-    Indices[i] = Malloc<int>(RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]");
+    Indices[i] = new int[RowCounter[i]];
     FragmentNumber = FixedDigitNumber(MatrixCounter, i);
     //Log() << Verbose(0) << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
-    Free(&FragmentNumber);
+    delete[](FragmentNumber);
     for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
       line >> Indices[i][j];
@@ -639,5 +643,5 @@
     //Log() << Verbose(0) << endl;
   }
-  Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]");
+  Indices[MatrixCounter] = new int[RowCounter[MatrixCounter]];
   for(int j=RowCounter[MatrixCounter];j--;) {
     Indices[MatrixCounter][j] = j;
@@ -700,5 +704,5 @@
     input.open(file.str().c_str(), ios::in);
     if (input == NULL) {
-      DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl);
+      DoLog(0) && (Log() << Verbose(0) << endl << "ForceMatrix::ParseFragmentMatrix: Unable to open " << file.str() << ", is the directory correct?" << endl);
       return false;
     }
@@ -725,7 +729,7 @@
     // allocate last plus one matrix
     DoLog(0) && (Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl);
-    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
+    Matrix[MatrixCounter] = new double*[RowCounter[MatrixCounter] + 1];
     for(int j=0;j<=RowCounter[MatrixCounter];j++)
-      Matrix[MatrixCounter][j] = Malloc<double>(ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
+      Matrix[MatrixCounter][j] = new double[ColumnCounter[MatrixCounter]];
 
     // try independently to parse global forcesuffix file if present
@@ -754,10 +758,10 @@
   
   DoLog(0) && (Log() << Verbose(0) << "Parsing hessian indices for " << MatrixCounter << " matrices." << endl);
-  Indices = Malloc<int*>(MatrixCounter + 1, "HessianMatrix::ParseIndices: **Indices");
+  Indices = new int*[MatrixCounter + 1];
   line << name << FRAGMENTPREFIX << FORCESFILE;
   input.open(line.str().c_str(), ios::in);
   //Log() << Verbose(0) << "Opening " << line.str() << " ... "  << input << endl;
   if (input == NULL) {
-    DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl);
+    DoLog(0) && (Log() << Verbose(0) << endl << "HessianMatrix::ParseIndices: Unable to open " << line.str() << ", is the directory correct?" << endl);
     return false;
   }
@@ -767,8 +771,8 @@
     line.str(filename);
     // parse the values
-    Indices[i] = Malloc<int>(RowCounter[i], "HessianMatrix::ParseIndices: *Indices[]");
+    Indices[i] = new int[RowCounter[i]];
     FragmentNumber = FixedDigitNumber(MatrixCounter, i);
     //Log() << Verbose(0) << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
-    Free(&FragmentNumber);
+    delete[](FragmentNumber);
     for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
       line >> Indices[i][j];
@@ -777,5 +781,5 @@
     //Log() << Verbose(0) << endl;
   }
-  Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "HessianMatrix::ParseIndices: *Indices[]");
+  Indices[MatrixCounter] = new int[RowCounter[MatrixCounter]];
   for(int j=RowCounter[MatrixCounter];j--;) {
     Indices[MatrixCounter][j] = j;
@@ -930,5 +934,5 @@
     input.open(file.str().c_str(), ios::in);
     if (input == NULL) {
-      DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl);
+      DoLog(0) && (Log() << Verbose(0) << endl << "HessianMatrix::ParseFragmentMatrix: Unable to open " << file.str() << ", is the directory correct?" << endl);
       return false;
     }
@@ -953,7 +957,7 @@
     // allocate last plus one matrix
     DoLog(0) && (Log() << Verbose(0) << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl);
-    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
+    Matrix[MatrixCounter] = new double*[RowCounter[MatrixCounter] + 1];
     for(int j=0;j<=RowCounter[MatrixCounter];j++)
-      Matrix[MatrixCounter][j] = Malloc<double>(ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
+      Matrix[MatrixCounter][j] = new double[ColumnCounter[MatrixCounter]];
 
     // try independently to parse global forcesuffix file if present
@@ -985,11 +989,11 @@
 KeySetsContainer::~KeySetsContainer() {
   for(int i=FragmentCounter;i--;)
-    Free(&KeySets[i]);
+    delete[](KeySets[i]);
   for(int i=Order;i--;)
-    Free(&OrderSet[i]);
-  Free(&KeySets);
-  Free(&OrderSet);
-  Free(&AtomCounter);
-  Free(&FragmentsPerOrder);
+    delete[](OrderSet[i]);
+  delete[](KeySets);
+  delete[](OrderSet);
+  delete[](AtomCounter);
+  delete[](FragmentsPerOrder);
 };
 
@@ -1008,5 +1012,5 @@
   FragmentCounter = FCounter;
   DoLog(0) && (Log() << Verbose(0) << "Parsing key sets." << endl);
-  KeySets = Malloc<int*>(FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets");
+  KeySets = new int*[FragmentCounter];
   for(int i=FragmentCounter;i--;)
     KeySets[i] = NULL;
@@ -1014,19 +1018,19 @@
   input.open(file.str().c_str(), ios::in);
   if (input == NULL) {
-    DoLog(0) && (Log() << Verbose(0) << endl << "Unable to open " << file.str() << ", is the directory correct?" << endl);
+    DoLog(0) && (Log() << Verbose(0) << endl << "KeySetsContainer::ParseKeySets: Unable to open " << file.str() << ", is the directory correct?" << endl);
     return false;
   }
 
-  AtomCounter = Malloc<int>(FragmentCounter, "KeySetsContainer::ParseKeySets: *RowCounter");
+  AtomCounter = new int[FragmentCounter];
   for(int i=0;(i<FragmentCounter) && (!input.eof());i++) {
     stringstream line;
     AtomCounter[i] = ACounter[i];
     // parse the values
-    KeySets[i] = Malloc<int>(AtomCounter[i], "KeySetsContainer::ParseKeySets: *KeySets[]");
+    KeySets[i] = new int[AtomCounter[i]];
     for(int j=AtomCounter[i];j--;)
       KeySets[i][j] = -1;
     FragmentNumber = FixedDigitNumber(FragmentCounter, i);
     //Log() << Verbose(0) << FRAGMENTPREFIX << FragmentNumber << "[" << AtomCounter[i] << "]:";
-    Free(&FragmentNumber);
+    delete[](FragmentNumber);
     input.getline(filename, 1023);
     line.str(filename);
@@ -1062,5 +1066,5 @@
 
   // scan through all to determine fragments per order
-  FragmentsPerOrder = Malloc<int>(Order, "KeySetsContainer::ParseManyBodyTerms: *FragmentsPerOrder");
+  FragmentsPerOrder = new int[Order];
   for(int i=Order;i--;)
     FragmentsPerOrder[i] = 0;
@@ -1076,7 +1080,7 @@
 
   // scan through all to gather indices to each order set
-  OrderSet = Malloc<int*>(Order, "KeySetsContainer::ParseManyBodyTerms: **OrderSet");
+  OrderSet = new int*[Order];
   for(int i=Order;i--;)
-    OrderSet[i] = Malloc<int>(FragmentsPerOrder[i], "KeySetsContainer::ParseManyBodyTermsKeySetsContainer::ParseManyBodyTerms: *OrderSet[]");
+    OrderSet[i] = new int[FragmentsPerOrder[i]];
   for(int i=Order;i--;)
     FragmentsPerOrder[i] = 0;
Index: src/periodentafel.cpp
===================================================================
--- src/periodentafel.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/periodentafel.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -45,4 +45,5 @@
 /** destructor for class periodentafel
  * Removes every element and afterwards deletes start and end of list.
+ * TODO: Handle when elements have changed and store databases then
  */
 periodentafel::~periodentafel()
@@ -275,5 +276,7 @@
 bool periodentafel::LoadElementsDatabase(istream *input)
 {
-  if ((*input) != NULL) {
+  bool status = true;
+  int counter = 0;
+  if (!(*input).fail()) {
     (*input).getline(header1, MAXSTRINGSIZE);
     (*input).getline(header2, MAXSTRINGSIZE); // skip first two header lines
@@ -300,5 +303,4 @@
       //(*input) >> ws;
       (*input) >> ws;
-      DoLog(0) && (Log() << Verbose(0) << " " << neues->symbol);
       if (elements.count(neues->Z)) {// if element already present, remove and delete it
         element * const Elemental = FindElement(neues->Z);
@@ -308,16 +310,22 @@
       }
       //neues->Output((ofstream *)&cout);
-      if ((neues->Z > 0) && (neues->Z < MAX_ELEMENTS))
+      if ((neues->Z > 0) && (neues->Z < MAX_ELEMENTS)) {
+        DoLog(0) && (Log() << Verbose(0) << " " << neues->symbol);
         elements[neues->getNumber()] = neues;
-      else {
-        DoLog(0) && (Log() << Verbose(0) << "Could not parse element: ");
-        neues->Output((ofstream *)&cout);
+        counter++;
+      } else {
+        DoeLog(2) && (eLog() << Verbose(2) << "Detected empty line or invalid element in elements db, discarding." << endl);
+        DoLog(0) && (Log() << Verbose(0) << " <?>");
         delete(neues);
       }
     }
     DoLog(0) && (Log() << Verbose(0) << endl);
-    return true;
-  } else
-    return false;
+  } else
+    status = false;
+
+  if (counter == 0)
+    status = false;
+
+  return status;
 }
 
@@ -329,5 +337,5 @@
 {
   char dummy[MAXSTRINGSIZE];
-  if ((*input) != NULL) {
+  if (!(*input).fail()) {
     (*input).getline(dummy, MAXSTRINGSIZE);
     while (!(*input).eof()) {
@@ -352,5 +360,5 @@
 {
   char dummy[MAXSTRINGSIZE];
-  if ((*input) != NULL) {
+  if (!(*input).fail()) {
     (*input).getline(dummy, MAXSTRINGSIZE);
     while (!(*input).eof()) {
@@ -375,5 +383,5 @@
 {
   char dummy[MAXSTRINGSIZE];
-  if ((*input) != NULL) {
+  if (!(*input).fail()) {
     (*input).getline(dummy, MAXSTRINGSIZE);
     while (!(*input).eof()) {
@@ -400,5 +408,5 @@
 {
   char dummy[MAXSTRINGSIZE];
-  if ((*input) != NULL) {
+  if (!(*input).fail()) {
     (*input).getline(dummy, MAXSTRINGSIZE);
     while (!(*input).eof()) {
Index: src/stackclass.hpp
===================================================================
--- src/stackclass.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/stackclass.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -50,5 +50,7 @@
 template <typename T> StackClass<T>::StackClass(int dimension) : StackList(NULL), EntryCount(dimension), CurrentLastEntry(0), CurrentFirstEntry(0), NextFreeField(0)
 {
-  StackList = Calloc<T>(EntryCount, "StackClass::StackClass: **StackList");
+  StackList = new T[EntryCount];
+  for (int i=0;i<EntryCount;i++)
+    StackList[i] = NULL;
 };
 
@@ -57,5 +59,5 @@
 template <typename T> StackClass<T>::~StackClass()
 {
-  Free(&StackList);
+  delete[](StackList);
 };
 
Index: src/tesselation.cpp
===================================================================
--- src/tesselation.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/tesselation.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -21,4 +21,7 @@
 #include "Plane.hpp"
 #include "Exceptions/LinearDependenceException.hpp"
+#include "Helpers/Assert.hpp"
+
+#include "Helpers/Assert.hpp"
 
 class molecule;
@@ -83,5 +86,5 @@
 ostream & operator <<(ostream &ost, const BoundaryPointSet &a)
 {
-  ost << "[" << a.Nr << "|" << a.node->Name << " at " << *a.node->node << "]";
+  ost << "[" << a.Nr << "|" << a.node->getName() << " at " << *a.node->node << "]";
   return ost;
 }
@@ -321,5 +324,5 @@
 ostream & operator <<(ostream &ost, const BoundaryLineSet &a)
 {
-  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << "," << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "]";
+  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->getName() << " at " << *a.endpoints[0]->node->node << "," << a.endpoints[1]->node->getName() << " at " << *a.endpoints[1]->node->node << "]";
   return ost;
 }
@@ -357,5 +360,5 @@
   // get ascending order of endpoints
   PointMap OrderMap;
-  for (int i = 0; i < 3; i++)
+  for (int i = 0; i < 3; i++) {
     // for all three lines
     for (int j = 0; j < 2; j++) { // for both endpoints
@@ -363,4 +366,5 @@
       // and we don't care whether insertion fails
     }
+  }
   // set endpoints
   int Counter = 0;
@@ -371,10 +375,7 @@
     Counter++;
   }
-  if (Counter < 3) {
-    DoeLog(0) && (eLog() << Verbose(0) << "We have a triangle with only two distinct endpoints!" << endl);
-    performCriticalExit();
-  }
-}
-;
+  ASSERT(Counter >= 3,"We have a triangle with only two distinct endpoints!");
+};
+
 
 /** Destructor of BoundaryTriangleSet.
@@ -682,4 +683,27 @@
 }
 
+/**
+ * gets the Plane defined by the three triangle Basepoints
+ */
+Plane BoundaryTriangleSet::getPlane() const{
+  ASSERT(endpoints[0] && endpoints[1] && endpoints[2], "Triangle not fully defined");
+
+  return Plane(*endpoints[0]->node->node,
+               *endpoints[1]->node->node,
+               *endpoints[2]->node->node);
+}
+
+Vector BoundaryTriangleSet::getEndpoint(int i) const{
+  ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
+
+  return *endpoints[i]->node->node;
+}
+
+string BoundaryTriangleSet::getEndpointName(int i) const{
+  ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
+
+  return endpoints[i]->node->getName();
+}
+
 /** output operator for BoundaryTriangleSet.
  * \param &ost output stream
@@ -688,5 +712,5 @@
 ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a)
 {
-  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << "," << a.endpoints[1]->node->Name << "," << a.endpoints[2]->node->Name << "]";
+  ost << "[" << a.Nr << "|" << a.getEndpointName(0) << "," << a.getEndpointName(1) << "," << a.getEndpointName(2) << "]";
   //  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
   //      << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]";
@@ -948,5 +972,5 @@
   ost << "[" << a.Nr << "|";
   for (PointSet::const_iterator Runner = a.endpoints.begin(); Runner != a.endpoints.end();) {
-    ost << (*Runner)->node->Name;
+    ost << (*Runner)->node->getName();
     Runner++;
     if (Runner != a.endpoints.end())
@@ -967,5 +991,4 @@
   node = NULL;
   nr = -1;
-  Name = NULL;
 }
 ;
@@ -983,5 +1006,5 @@
 ostream & operator <<(ostream &ost, const TesselPoint &a)
 {
-  ost << "[" << (a.Name) << "|" << a.Name << " at " << *a.node << "]";
+  ost << "[" << a.getName() << "|" << *a.node << "]";
   return ost;
 }
@@ -1135,5 +1158,5 @@
 ostream & operator <<(ostream &ost, const CandidateForTesselation &a)
 {
-  ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with ";
+  ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->getName() << "," << a.BaseLine->endpoints[1]->node->getName() << "] with ";
   if (a.pointlist.empty())
     ost << "no candidate.";
@@ -1209,16 +1232,4 @@
 ;
 
-/** PointCloud implementation of GetTerminalPoint.
- * Uses PointsOnBoundary and STL stuff.
- */
-TesselPoint * Tesselation::GetTerminalPoint() const
-{
-  Info FunctionInfo(__func__);
-  PointMap::const_iterator Runner = PointsOnBoundary.end();
-  Runner--;
-  return (Runner->second->node);
-}
-;
-
 /** PointCloud implementation of GoToNext.
  * Uses PointsOnBoundary and STL stuff.
@@ -1232,15 +1243,4 @@
 ;
 
-/** PointCloud implementation of GoToPrevious.
- * Uses PointsOnBoundary and STL stuff.
- */
-void Tesselation::GoToPrevious() const
-{
-  Info FunctionInfo(__func__);
-  if (InternalPointer != PointsOnBoundary.begin())
-    InternalPointer--;
-}
-;
-
 /** PointCloud implementation of GoToFirst.
  * Uses PointsOnBoundary and STL stuff.
@@ -1250,15 +1250,4 @@
   Info FunctionInfo(__func__);
   InternalPointer = PointsOnBoundary.begin();
-}
-;
-
-/** PointCloud implementation of GoToLast.
- * Uses PointsOnBoundary and STL stuff.
- */
-void Tesselation::GoToLast() const
-{
-  Info FunctionInfo(__func__);
-  InternalPointer = PointsOnBoundary.end();
-  InternalPointer--;
 }
 ;
@@ -1348,13 +1337,13 @@
       if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok
         continue;
-      DoLog(2) && (Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl);
+      DoLog(2) && (Log() << Verbose(2) << "Projection of " << checker->second->node->getName() << " yields distance of " << distance << "." << endl);
       tmp = distance / fabs(distance);
       // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle)
       if ((sign != 0) && (tmp != sign)) {
         // 4c. If so, break 4. loop and continue with next candidate in 1. loop
-        DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leaves " << checker->second->node->Name << " outside the convex hull." << endl);
+        DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leaves " << checker->second->node->getName() << " outside the convex hull." << endl);
         break;
       } else { // note the sign for later
-        DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leave " << checker->second->node->Name << " inside the convex hull." << endl);
+        DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->getName() << "," << baseline->second.first->second->node->getName() << "," << baseline->second.second->second->node->getName() << " leave " << checker->second->node->getName() << " inside the convex hull." << endl);
         sign = tmp;
       }
@@ -1456,5 +1445,5 @@
         CenterVector.Zero();
         for (int i = 0; i < 3; i++)
-          CenterVector += (*BTS->endpoints[i]->node->node);
+          CenterVector += BTS->getEndpoint(i);
         CenterVector.Scale(1. / 3.);
         DoLog(2) && (Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl);
@@ -1933,8 +1922,8 @@
         RemoveTesselationLine(triangle->lines[i]);
       } else {
-        DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: ");
+        DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: " << endl);
         OpenLines.insert(pair<BoundaryLineSet *, CandidateForTesselation *> (triangle->lines[i], NULL));
         for (TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++)
-          DoLog(0) && (Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t");
+          DoLog(0) && (Log() << Verbose(0) << "\t[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t");
         DoLog(0) && (Log() << Verbose(0) << endl);
         //        for (int j=0;j<2;j++) {
@@ -2570,4 +2559,5 @@
   // fill the set of neighbours
   TesselPointSet SetOfNeighbours;
+
   SetOfNeighbours.insert(CandidateLine.BaseLine->endpoints[1]->node);
   for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++)
@@ -2989,8 +2979,14 @@
   OldBaseLineNr = Base->Nr;
   m = 0;
-  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
-    DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl);
-    OldTriangleNrs[m++] = runner->second->Nr;
-    RemoveTesselationTriangle(runner->second);
+  // first obtain all triangle to delete ... (otherwise we pull the carpet (Base) from under the for-loop's feet)
+  list <BoundaryTriangleSet *> TrianglesOfBase;
+  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); ++runner)
+    TrianglesOfBase.push_back(runner->second);
+  // .. then delete each triangle (which deletes the line as well)
+  for (list <BoundaryTriangleSet *>::iterator runner = TrianglesOfBase.begin(); !TrianglesOfBase.empty(); runner = TrianglesOfBase.begin()) {
+    DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting triangle " << *(*runner) << "." << endl);
+    OldTriangleNrs[m++] = (*runner)->Nr;
+    RemoveTesselationTriangle((*runner));
+    TrianglesOfBase.erase(runner);
   }
 
@@ -4292,5 +4288,5 @@
         DoLog(2) && (Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl);
         DoLog(2) && (Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl);
-        DoLog(1) && (Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl);
+        DoLog(1) && (Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->getName() << ", " << (*MiddleNode)->getName() << " and " << (*EndNode)->getName() << "." << endl);
         TriangleCandidates[0] = *StartNode;
         TriangleCandidates[1] = *MiddleNode;
@@ -4714,5 +4710,5 @@
     return;
   }
-  DoLog(0) && (Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl);
+  DoLog(0) && (Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->getName() << "." << endl);
 
   // go through its lines and find the best one to split
@@ -4799,8 +4795,10 @@
   ofstream *tempstream = NULL;
   string NameofTempFile;
-  char NumberName[255];
+  string NumberName;
 
   if (LastTriangle != NULL) {
-    sprintf(NumberName, "-%04d-%s_%s_%s", (int) TrianglesOnBoundary.size(), LastTriangle->endpoints[0]->node->Name, LastTriangle->endpoints[1]->node->Name, LastTriangle->endpoints[2]->node->Name);
+    stringstream sstr;
+    sstr << "-"<< TrianglesOnBoundary.size() << "-" << LastTriangle->getEndpointName(0) << "_" << LastTriangle->getEndpointName(1) << "_" << LastTriangle->getEndpointName(2);
+    NumberName = sstr.str();
     if (DoTecplotOutput) {
       string NameofTempFile(filename);
Index: src/tesselation.hpp
===================================================================
--- src/tesselation.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/tesselation.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -38,4 +38,5 @@
 class PointCloud;
 class Tesselation;
+class Plane;
 
 /********************************************** definitions *********************************/
@@ -166,4 +167,8 @@
     bool IsPresentTupel(const BoundaryTriangleSet * const T) const;
 
+    Plane getPlane() const;
+    Vector getEndpoint(int) const;
+    std::string getEndpointName(int) const;
+
     class BoundaryPointSet *endpoints[3];
     class BoundaryLineSet *lines[3];
@@ -171,4 +176,7 @@
     Vector SphereCenter;
     int Nr;
+
+  private:
+
 };
 
@@ -236,10 +244,7 @@
   virtual Vector *GetCenter() const { return NULL; };
   virtual TesselPoint *GetPoint() const { return NULL; };
-  virtual TesselPoint *GetTerminalPoint() const { return NULL; };
   virtual int GetMaxId() const { return 0; };
   virtual void GoToNext() const {};
-  virtual void GoToPrevious() const {};
   virtual void GoToFirst() const {};
-  virtual void GoToLast() const {};
   virtual bool IsEmpty() const { return true; };
   virtual bool IsEnd() const { return true; };
@@ -355,9 +360,6 @@
     virtual Vector *GetCenter(ofstream *out) const;
     virtual TesselPoint *GetPoint() const;
-    virtual TesselPoint *GetTerminalPoint() const;
     virtual void GoToNext() const;
-    virtual void GoToPrevious() const;
     virtual void GoToFirst() const;
-    virtual void GoToLast() const;
     virtual bool IsEmpty() const;
     virtual bool IsEnd() const;
Index: src/tesselationhelpers.cpp
===================================================================
--- src/tesselationhelpers.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/tesselationhelpers.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -16,4 +16,5 @@
 #include "vector_ops.hpp"
 #include "verbose.hpp"
+#include "Plane.hpp"
 
 double DetGet(gsl_matrix * const A, const int inPlace)
@@ -687,5 +688,5 @@
     return -1;
   }
-  distance = x->DistanceToPlane(triangle->NormalVector, *triangle->endpoints[0]->node->node);
+  distance = x->DistanceToSpace(triangle->getPlane());
   return distance;
 };
@@ -784,6 +785,8 @@
       Walker = cloud->GetPoint();
       *rasterfile << "2" << endl << "  ";  // 2 is sphere type
-      for (i=0;i<NDIM;i++)
-        *rasterfile << Walker->node->at(i)-center->at(i) << " ";
+      for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates
+        const double tmp = Walker->node->at(j)-center->at(j);
+        *rasterfile << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
+      }
       *rasterfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour
       cloud->GoToNext();
@@ -795,6 +798,8 @@
       *rasterfile << "1" << endl << "  ";  // 1 is triangle type
       for (i=0;i<3;i++) {  // print each node
-        for (int j=0;j<NDIM;j++)  // and for each node all NDIM coordinates
-          *rasterfile << TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j) << " ";
+        for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates
+          const double tmp = TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j);
+          *rasterfile << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
+        }
         *rasterfile << "\t";
       }
@@ -829,5 +834,5 @@
       if (TesselStruct->LastTriangle != NULL) {
         for (int i=0;i<3;i++)
-          *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name;
+          *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->getName();
       } else {
         *tecplot << "none";
@@ -835,16 +840,21 @@
     }
     *tecplot << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl;
-    int i=cloud->GetMaxId();
-    int *LookupList = new int[i];
-    for (cloud->GoToFirst(), i=0; !cloud->IsEnd(); cloud->GoToNext(), i++)
+    const int MaxId=cloud->GetMaxId();
+    int *LookupList = new int[MaxId];
+    for (int i=0; i< MaxId ; i++){
       LookupList[i] = -1;
+    }
 
     // print atom coordinates
     int Counter = 1;
     TesselPoint *Walker = NULL;
-    for (PointMap::const_iterator target = TesselStruct->PointsOnBoundary.begin(); target != TesselStruct->PointsOnBoundary.end(); target++) {
+    for (PointMap::const_iterator target = TesselStruct->PointsOnBoundary.begin(); target != TesselStruct->PointsOnBoundary.end(); ++target) {
       Walker = target->second->node;
       LookupList[Walker->nr] = Counter++;
-      *tecplot << Walker->node->at(0) << " " << Walker->node->at(1) << " " << Walker->node->at(2) << " " << target->second->value << endl;
+      for (int i=0;i<NDIM;i++) {
+        const double tmp = Walker->node->at(i);
+        *tecplot << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
+      }
+      *tecplot << target->second->value << endl;
     }
     *tecplot << endl;
@@ -852,5 +862,5 @@
     DoLog(1) && (Log() << Verbose(1) << "The following triangles were created:" << endl);
     for (TriangleMap::const_iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) {
-      DoLog(1) && (Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name << endl);
+      DoLog(1) && (Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->getName() << "<->" << runner->second->endpoints[1]->node->getName() << "<->" << runner->second->endpoints[2]->node->getName() << endl);
       *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl;
     }
Index: src/unittests/ActOnAllUnitTest.cpp
===================================================================
--- src/unittests/ActOnAllUnitTest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/ActOnAllUnitTest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -46,5 +46,4 @@
   // Ref was copy constructed, hence has to be cleaned, too!
   Ref.EmptyList();
-  MemoryUsageObserver::purgeInstance();
 };
 
@@ -77,6 +76,6 @@
 
   // scaling by three values
-  double *factors = Malloc<double>(NDIM, "ActOnAllTest::ScaleTest - factors");
-  double *inverses = Malloc<double>(NDIM, "ActOnAllTest::ScaleTest - inverses");
+  double *factors = new double[NDIM];
+  double *inverses = new double[NDIM];
   for (int i=0;i<NDIM;++i) {
     factors[i] = 2.;
@@ -88,6 +87,6 @@
   VL.ActOnAll<Vector,void,const double*>(&Vector::ScaleAll, inverses );
   CPPUNIT_ASSERT_EQUAL( VL == Ref , true );
-  Free(factors);
-  Free(inverses);
+  delete[](factors);
+  delete[](inverses);
 };
 
Index: src/unittests/AnalysisCorrelationToPointUnitTest.cpp
===================================================================
--- src/unittests/AnalysisCorrelationToPointUnitTest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/AnalysisCorrelationToPointUnitTest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -66,5 +66,5 @@
 
   // check that TestMolecule was correctly constructed
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
+  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
 
   TestList = World::getInstance().getMolecules();
@@ -91,5 +91,4 @@
   delete(point);
   World::purgeInstance();
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
 };
Index: src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
===================================================================
--- src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -25,4 +25,5 @@
 #include "tesselation.hpp"
 #include "World.hpp"
+#include "Helpers/Assert.hpp"
 
 #include "Helpers/Assert.hpp"
@@ -39,5 +40,5 @@
 void AnalysisCorrelationToSurfaceUnitTest::setUp()
 {
-  //ASSERT_DO(Assert::Throw);
+  ASSERT_DO(Assert::Throw);
 
   atom *Walker = NULL;
@@ -54,17 +55,20 @@
   hydrogen = World::getInstance().getPeriode()->FindElement(1);
   TestSurfaceMolecule = World::getInstance().createMolecule();
+
   Walker = World::getInstance().createAtom();
   Walker->type = hydrogen;
   *Walker->node = Vector(1., 0., 1. );
-
-  TestSurfaceMolecule->AddAtom(Walker);
+  TestSurfaceMolecule->AddAtom(Walker);
+
   Walker = World::getInstance().createAtom();
   Walker->type = hydrogen;
   *Walker->node = Vector(0., 1., 1. );
   TestSurfaceMolecule->AddAtom(Walker);
+
   Walker = World::getInstance().createAtom();
   Walker->type = hydrogen;
   *Walker->node = Vector(1., 1., 0. );
   TestSurfaceMolecule->AddAtom(Walker);
+
   Walker = World::getInstance().createAtom();
   Walker->type = hydrogen;
@@ -73,5 +77,5 @@
 
   // check that TestMolecule was correctly constructed
-  CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->AtomCount, 4 );
+  CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->getAtomCount(), 4 );
 
   TestList = World::getInstance().getMolecules();
@@ -91,12 +95,15 @@
   *Walker->node = Vector(4., 0., 4. );
   TestSurfaceMolecule->AddAtom(Walker);
+
   Walker = World::getInstance().createAtom();
   Walker->type = carbon;
   *Walker->node = Vector(0., 4., 4. );
   TestSurfaceMolecule->AddAtom(Walker);
+
   Walker = World::getInstance().createAtom();
   Walker->type = carbon;
   *Walker->node = Vector(4., 4., 0. );
   TestSurfaceMolecule->AddAtom(Walker);
+
   // add inner atoms
   Walker = World::getInstance().createAtom();
@@ -104,4 +111,5 @@
   *Walker->node = Vector(0.5, 0.5, 0.5 );
   TestSurfaceMolecule->AddAtom(Walker);
+
   TestSurfaceMolecule->ActiveFlag = true;
   TestList->insert(TestSurfaceMolecule);
@@ -125,5 +133,4 @@
   delete(LC);
   World::purgeInstance();
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
 };
@@ -134,5 +141,5 @@
 void AnalysisCorrelationToSurfaceUnitTest::SurfaceTest()
 {
-  CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->AtomCount );
+  CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->getAtomCount() );
   CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() );
   CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
Index: src/unittests/AnalysisPairCorrelationUnitTest.cpp
===================================================================
--- src/unittests/AnalysisPairCorrelationUnitTest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/AnalysisPairCorrelationUnitTest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -68,5 +68,5 @@
 
   // check that TestMolecule was correctly constructed
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
+  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
 
   TestList = World::getInstance().getMolecules();
@@ -90,5 +90,4 @@
   // note that all the atoms are cleaned by TestMolecule
   World::purgeInstance();
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
   errorLogger::purgeInstance();
Index: src/unittests/CountBondsUnitTest.cpp
===================================================================
--- src/unittests/CountBondsUnitTest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/CountBondsUnitTest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -92,10 +92,6 @@
 
   // check that TestMolecule was correctly constructed
-  CPPUNIT_ASSERT_EQUAL( TestMolecule1->AtomCount, 3 );
-  Walker = TestMolecule1->start->next;
-  CPPUNIT_ASSERT( TestMolecule1->end != Walker );
-  CPPUNIT_ASSERT_EQUAL( TestMolecule2->AtomCount, 3 );
-  Walker = TestMolecule2->start->next;
-  CPPUNIT_ASSERT( TestMolecule2->end != Walker );
+  CPPUNIT_ASSERT_EQUAL( TestMolecule1->getAtomCount(), 3 );
+  CPPUNIT_ASSERT_EQUAL( TestMolecule2->getAtomCount(), 3 );
 
   // create a small file with table
@@ -117,5 +113,4 @@
 
   World::purgeInstance();
-  MemoryUsageObserver::purgeInstance();
 };
 
Index: src/unittests/LinkedCellUnitTest.cpp
===================================================================
--- src/unittests/LinkedCellUnitTest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/LinkedCellUnitTest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -60,7 +60,5 @@
 
   // check that TestMolecule was correctly constructed
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 3*3*3 );
-  Walker = TestMolecule->start->next;
-  CPPUNIT_ASSERT( TestMolecule->end != Walker );
+  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 3*3*3 );
 };
 
@@ -70,5 +68,4 @@
   delete(LC);
   World::purgeInstance();
-  MemoryUsageObserver::purgeInstance();
 };
 
@@ -188,25 +185,21 @@
 {
   // check all atoms
-  atom *Walker = TestMolecule->start;
-  while (Walker->next != TestMolecule->end) {
-    Walker = Walker->next;
-    CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(Walker) );
+  for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end();++iter){
+    CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(*iter) );
   }
 
   // check internal vectors, returns false, because this atom is not in LC-list!
-  Walker = World::getInstance().createAtom();
-  Walker->Name = Malloc<char>(6, "LinkedCellTest::SetIndexToNodeTest - Walker");
-  strcpy(Walker->Name, "test");
-  Walker->x= Vector(1,1,1);
-  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(Walker) );
-  World::getInstance().destroyAtom(Walker);
+  atom *newAtom = World::getInstance().createAtom();
+  newAtom->setName("test");
+  newAtom->x= Vector(1,1,1);
+  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
+  World::getInstance().destroyAtom(newAtom);
 
   // check out of bounds vectors
-  Walker = World::getInstance().createAtom();
-  Walker->Name = Malloc<char>(6, "LinkedCellTest::SetIndexToNodeTest - Walker");
-  strcpy(Walker->Name, "test");
-  Walker->x = Vector(0,-1,0);
-  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(Walker) );
-  World::getInstance().destroyAtom(Walker);
+  newAtom = World::getInstance().createAtom();
+  newAtom->setName("test");
+  newAtom->x = Vector(0,-1,0);
+  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
+  World::getInstance().destroyAtom(newAtom);
 };
 
@@ -280,9 +273,7 @@
   size = ListOfPoints->size();
   CPPUNIT_ASSERT_EQUAL( (size_t)27, size );
-  Walker = TestMolecule->start;
-  Walker = TestMolecule->start;
-  while (Walker->next != TestMolecule->end) {
-    Walker = Walker->next;
-    ListOfPoints->remove(Walker);
+
+  for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){
+    ListOfPoints->remove((*iter));
     size--;
     CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
@@ -299,9 +290,7 @@
   size=ListOfPoints->size();
   CPPUNIT_ASSERT_EQUAL( (size_t)8, size );
-  Walker = TestMolecule->start;
-  while (Walker->next != TestMolecule->end) {
-    Walker = Walker->next;
-    if ((Walker->x[0] <2) && (Walker->x[1] <2) && (Walker->x[2] <2)) {
-      ListOfPoints->remove(Walker);
+  for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){
+    if (((*iter)->x[0] <2) && ((*iter)->x[1] <2) && ((*iter)->x[2] <2)) {
+      ListOfPoints->remove(*iter);
       size--;
       CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
@@ -319,8 +308,6 @@
   size=ListOfPoints->size();
   CPPUNIT_ASSERT_EQUAL( (size_t)27, size );
-  Walker = TestMolecule->start;
-  while (Walker->next != TestMolecule->end) {
-    Walker = Walker->next;
-    ListOfPoints->remove(Walker);
+  for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){
+    ListOfPoints->remove(*iter);
     size--;
     CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
@@ -348,9 +335,7 @@
   size = ListOfPoints->size();
   CPPUNIT_ASSERT_EQUAL( (size_t)7, size );
-  Walker = TestMolecule->start;
-  while (Walker->next != TestMolecule->end) {
-    Walker = Walker->next;
-    if ((Walker->x.DistanceSquared(tester) - 1.) < MYEPSILON ) {
-      ListOfPoints->remove(Walker);
+  for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){
+    if (((*iter)->x.DistanceSquared(tester) - 1.) < MYEPSILON ) {
+      ListOfPoints->remove(*iter);
       size--;
       CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
Index: src/unittests/Makefile.am
===================================================================
--- src/unittests/Makefile.am	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/Makefile.am	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -49,6 +49,6 @@
 noinst_PROGRAMS = $(TESTS) TestRunner
 
-GSLLIBS = ../libgslwrapper.a
-ALLLIBS = ../libmolecuilder.a ${GSLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB}
+GSLLIBS = ../libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
+ALLLIBS = ../libmolecuilder.a ${GSLLIBS} 
 
 TESTSOURCES = \
@@ -182,8 +182,8 @@
 manipulateAtomsTest_LDADD = ${ALLLIBS}
 
-MemoryAllocatorUnitTest_SOURCES = UnitTestMain.cpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp 
+MemoryAllocatorUnitTest_SOURCES = UnitTestMain.cpp ../memoryallocator.hpp ../memoryallocator.cpp ../memoryusageobserver.cpp ../memoryusageobserver.hpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp 
 MemoryAllocatorUnitTest_LDADD = ${ALLLIBS}
 
-MemoryUsageObserverUnitTest_SOURCES = UnitTestMain.cpp memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp 
+MemoryUsageObserverUnitTest_SOURCES = UnitTestMain.cpp ../memoryallocator.hpp ../memoryusageobserver.cpp ../memoryusageobserver.hpp memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp 
 MemoryUsageObserverUnitTest_LDADD = ${ALLLIBS}
 
@@ -218,5 +218,5 @@
 Tesselation_InOutsideUnitTest_LDADD = ${ALLLIBS}
 
-TestRunner_SOURCES = TestRunnerMain.cpp $(TESTSOURCES) $(TESTHEADERS)
+TestRunner_SOURCES = TestRunnerMain.cpp ../memoryallocator.hpp ../memoryallocator.cpp ../memoryusageobserver.cpp ../memoryusageobserver.hpp $(TESTSOURCES) $(TESTHEADERS)
 TestRunner_LDADD = ${ALLLIBS}
 
Index: src/unittests/ObserverTest.cpp
===================================================================
--- src/unittests/ObserverTest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/ObserverTest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -11,6 +11,8 @@
 #include <cppunit/extensions/TestFactoryRegistry.h>
 #include <cppunit/ui/text/TestRunner.h>
+#include <set>
 
 #include "Patterns/Observer.hpp"
+#include "Patterns/ObservedIterator.hpp"
 #include "Helpers/Assert.hpp"
 
@@ -162,4 +164,42 @@
   bool wasNotified;
 };
+
+class ObservableCollection : public Observable {
+public:
+  typedef std::set<SimpleObservable*> set;
+  typedef ObservedIterator<set> iterator;
+  typedef set::const_iterator const_iterator;
+
+  ObservableCollection(int _num) :
+  num(_num)
+  {
+    for(int i=0; i<num; ++i){
+      SimpleObservable *content = new SimpleObservable();
+      content->signOn(this);
+      theSet.insert(content);
+    }
+  }
+
+  ~ObservableCollection(){
+    set::iterator iter;
+    for(iter=theSet.begin(); iter!=theSet.end(); ++iter ){
+      delete (*iter);
+    }
+  }
+
+  iterator begin(){
+    return iterator(theSet.begin(),this);
+  }
+
+  iterator end(){
+    return iterator(theSet.end(),this);
+  }
+
+  const int num;
+
+private:
+  set theSet;
+};
+
 
 /******************* actuall tests ***************/
@@ -173,4 +213,5 @@
   blockObservable = new BlockObservable();
   notificationObservable = new NotificationObservable();
+  collection = new ObservableCollection(5);
 
   observer1 = new UpdateCountObserver();
@@ -181,5 +222,4 @@
   notificationObserver1 = new NotificationObserver(notificationObservable->notification1);
   notificationObserver2 = new NotificationObserver(notificationObservable->notification2);
-
 }
 
@@ -191,4 +231,5 @@
   delete blockObservable;
   delete notificationObservable;
+  delete collection;
 
   delete observer1;
@@ -277,4 +318,38 @@
   blockObservable->changeMethod2();
   blockObservable->noChangeMethod();
+}
+
+void ObserverTest::iteratorTest(){
+  int i = 0;
+  // test the general iterator methods
+  for(ObservableCollection::iterator iter=collection->begin(); iter!=collection->end();++iter){
+    CPPUNIT_ASSERT(i< collection->num);
+    i++;
+  }
+
+  i=0;
+  for(ObservableCollection::const_iterator iter=collection->begin(); iter!=collection->end();++iter){
+    CPPUNIT_ASSERT(i<collection->num);
+    i++;
+  }
+
+  collection->signOn(observer1);
+  {
+    // we construct this out of the loop, so the iterator dies at the end of
+    // the scope and not the end of the loop (allows more testing)
+    ObservableCollection::iterator iter;
+    for(iter=collection->begin(); iter!=collection->end(); ++iter){
+      (*iter)->changeMethod();
+    }
+    // At this point no change should have been propagated
+    CPPUNIT_ASSERT_EQUAL( 0, observer1->updates);
+  }
+  // After the Iterator has died the propagation should take place
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates);
+
+  // when using a const_iterator no changes should be propagated
+  for(ObservableCollection::const_iterator iter = collection->begin(); iter!=collection->end();++iter);
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates);
+  collection->signOff(observer1);
 }
 
Index: src/unittests/ObserverTest.hpp
===================================================================
--- src/unittests/ObserverTest.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/ObserverTest.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -17,7 +17,7 @@
 class CallObservable;
 class SuperObservable;
+class ObservableCollection;
 class BlockObservable;
 class NotificationObservable;
-
 
 class ObserverTest :  public CppUnit::TestFixture
@@ -29,4 +29,5 @@
   CPPUNIT_TEST ( doesNotifyTest );
   CPPUNIT_TEST ( doesReportTest );
+  CPPUNIT_TEST ( iteratorTest );
   CPPUNIT_TEST ( CircleDetectionTest );
   CPPUNIT_TEST_SUITE_END();
@@ -41,4 +42,5 @@
   void doesNotifyTest();
   void doesReportTest();
+  void iteratorTest();
   void CircleDetectionTest();
 
@@ -58,4 +60,6 @@
   SuperObservable *superObservable;
   NotificationObservable *notificationObservable;
+  ObservableCollection *collection;
+
 };
 
Index: src/unittests/analysisbondsunittest.cpp
===================================================================
--- src/unittests/analysisbondsunittest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/analysisbondsunittest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -25,4 +25,5 @@
 #include "molecule.hpp"
 #include "periodentafel.hpp"
+#include "World.hpp"
 
 #ifdef HAVE_TESTRUNNER
@@ -76,5 +77,5 @@
 
   // check that TestMolecule was correctly constructed
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 5 );
+  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 5 );
 
   // create a small file with table
Index: src/unittests/bondgraphunittest.cpp
===================================================================
--- src/unittests/bondgraphunittest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/bondgraphunittest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -77,5 +77,5 @@
 
   // check that TestMolecule was correctly constructed
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
+  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
 
   // create a small file with table
@@ -111,6 +111,13 @@
   // are all cleaned when the world is destroyed
   World::purgeInstance();
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
+};
+
+/** Tests whether setup worked.
+ */
+void BondGraphTest::SetupTest()
+{
+  CPPUNIT_ASSERT_EQUAL (false, TestMolecule->empty());
+  CPPUNIT_ASSERT_EQUAL ((size_t)4, TestMolecule->size());
 };
 
@@ -129,10 +136,10 @@
 void BondGraphTest::ConstructGraphFromTableTest()
 {
-  atom *Walker = TestMolecule->start->next;
-  atom *Runner = TestMolecule->end->previous;
-  CPPUNIT_ASSERT( TestMolecule->end != Walker );
+  molecule::iterator Walker = TestMolecule->begin();
+  molecule::iterator Runner = TestMolecule->begin();
+  Runner++;
   CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable(*filename) );
   CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) );
-  CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
+  CPPUNIT_ASSERT_EQUAL( true , (*Walker)->IsBondedTo((*Runner)) );
 };
 
@@ -141,10 +148,13 @@
 void BondGraphTest::ConstructGraphFromCovalentRadiiTest()
 {
-  atom *Walker = TestMolecule->start->next;
-  atom *Runner = TestMolecule->end->previous;
-  CPPUNIT_ASSERT( TestMolecule->end != Walker );
+
+  //atom *Walker = TestMolecule->start->next;
+  //atom *Runner = TestMolecule->end->previous;
+  //CPPUNIT_ASSERT( TestMolecule->end != Walker );
   CPPUNIT_ASSERT_EQUAL( false , BG->LoadBondLengthTable(*dummyname) );
   CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) );
-  CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
+
+  // this cannot be assured using dynamic IDs
+  //CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );
 };
 
Index: src/unittests/bondgraphunittest.hpp
===================================================================
--- src/unittests/bondgraphunittest.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/bondgraphunittest.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -22,4 +22,5 @@
 {
     CPPUNIT_TEST_SUITE( BondGraphTest) ;
+    CPPUNIT_TEST ( SetupTest );
     CPPUNIT_TEST ( LoadTableTest );
     CPPUNIT_TEST ( ConstructGraphFromTableTest );
@@ -30,4 +31,5 @@
       void setUp();
       void tearDown();
+      void SetupTest();
       void LoadTableTest();
       void ConstructGraphFromTableTest();
Index: src/unittests/listofbondsunittest.cpp
===================================================================
--- src/unittests/listofbondsunittest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/listofbondsunittest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -67,5 +67,5 @@
 
   // check that TestMolecule was correctly constructed
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
+  CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 );
 };
 
@@ -78,8 +78,16 @@
   // are all cleaned when the world is destroyed
   World::purgeInstance();
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
 };
 
+/** Tests whether setup worked correctly.
+ *
+ */
+void ListOfBondsTest::SetupTest()
+{
+  CPPUNIT_ASSERT_EQUAL( false, TestMolecule->empty() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)4, TestMolecule->size() );
+};
+
 /** Unit Test of molecule::AddBond()
  *
@@ -88,14 +96,15 @@
 {
   bond *Binder = NULL;
-  atom *atom1 = TestMolecule->start->next;
-  atom *atom2 = atom1->next;
-  CPPUNIT_ASSERT( atom1 != NULL );
-  CPPUNIT_ASSERT( atom2 != NULL );
-
-  // add bond
-  Binder = TestMolecule->AddBond(atom1, atom2, 1);
-  CPPUNIT_ASSERT( Binder != NULL );
-  bond *TestBond = TestMolecule->first->next;
-  CPPUNIT_ASSERT_EQUAL ( TestBond, Binder );
+  molecule::iterator iter = TestMolecule->begin();
+  atom *atom1 = *iter;
+  iter++;
+  atom *atom2 = *iter;
+  CPPUNIT_ASSERT( atom1 != NULL );
+  CPPUNIT_ASSERT( atom2 != NULL );
+
+  // add bond
+  Binder = TestMolecule->AddBond(atom1, atom2, 1);
+  CPPUNIT_ASSERT( Binder != NULL );
+  CPPUNIT_ASSERT_EQUAL ( true, TestMolecule->hasBondStructure() );
 
   // check that bond contains the two atoms
@@ -116,6 +125,8 @@
 {
   bond *Binder = NULL;
-  atom *atom1 = TestMolecule->start->next;
-  atom *atom2 = atom1->next;
+  molecule::iterator iter = TestMolecule->begin();
+  atom *atom1 = *iter;
+  iter++;
+  atom *atom2 = *iter;
   CPPUNIT_ASSERT( atom1 != NULL );
   CPPUNIT_ASSERT( atom2 != NULL );
@@ -133,5 +144,5 @@
 
   // check if removed from molecule
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, TestMolecule->last );
+  CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
 };
 
@@ -142,7 +153,10 @@
 {
   bond *Binder = NULL;
-  atom *atom1 = TestMolecule->start->next;
-  atom *atom2 = atom1->next;
-  atom *atom3 = atom2->next;
+  molecule::iterator iter = TestMolecule->begin();
+  atom *atom1 = *iter;
+  iter++;
+  atom *atom2 = *iter;
+  iter++;
+  atom *atom3 = *iter;
   CPPUNIT_ASSERT( atom1 != NULL );
   CPPUNIT_ASSERT( atom2 != NULL );
@@ -171,6 +185,6 @@
 
   // check if removed from molecule
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, Binder );
-  CPPUNIT_ASSERT_EQUAL( Binder->next, TestMolecule->last );
+  CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() );
+  CPPUNIT_ASSERT_EQUAL( (unsigned int)1, TestMolecule->CountBonds() );
 };
 
@@ -181,6 +195,8 @@
 {
   bond *Binder = NULL;
-  atom *atom1 = TestMolecule->start->next;
-  atom *atom2 = atom1->next;
+  molecule::iterator iter = TestMolecule->begin();
+  atom *atom1 = *iter;
+  iter++;
+  atom *atom2 = *iter;
   CPPUNIT_ASSERT( atom1 != NULL );
   CPPUNIT_ASSERT( atom2 != NULL );
@@ -198,5 +214,5 @@
 
   // check if removed from molecule
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, TestMolecule->last );
+  CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
 };
 
@@ -207,6 +223,8 @@
 {
   bond *Binder = NULL;
-  atom *atom1 = TestMolecule->start->next;
-  atom *atom2 = atom1->next;
+  molecule::iterator iter = TestMolecule->begin();
+  atom *atom1 = *iter;
+  iter++;
+  atom *atom2 = *iter;
   CPPUNIT_ASSERT( atom1 != NULL );
   CPPUNIT_ASSERT( atom2 != NULL );
@@ -223,5 +241,5 @@
 
   // check if removed from molecule
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, TestMolecule->last );
+  CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() );
 };
 
@@ -232,6 +250,8 @@
 {
   bond *Binder = NULL;
-  atom *atom1 = TestMolecule->start->next;
-  atom *atom2 = atom1->next;
+  molecule::iterator iter = TestMolecule->begin();
+  atom *atom1 = *iter;
+  iter++;
+  atom *atom2 = *iter;
   CPPUNIT_ASSERT( atom1 != NULL );
   CPPUNIT_ASSERT( atom2 != NULL );
@@ -248,4 +268,4 @@
 
   // check if removed from molecule
-  CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, TestMolecule->last );
-};
+  CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() );
+};
Index: src/unittests/listofbondsunittest.hpp
===================================================================
--- src/unittests/listofbondsunittest.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/listofbondsunittest.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -20,4 +20,5 @@
 {
     CPPUNIT_TEST_SUITE( ListOfBondsTest) ;
+    CPPUNIT_TEST ( SetupTest );
     CPPUNIT_TEST ( AddingBondTest );
     CPPUNIT_TEST ( RemovingBondTest );
@@ -31,4 +32,5 @@
       void setUp();
       void tearDown();
+      void SetupTest();
       void AddingBondTest();
       void RemovingBondTest();
Index: src/unittests/memoryallocatorunittest.cpp
===================================================================
--- src/unittests/memoryallocatorunittest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/memoryallocatorunittest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -12,4 +12,5 @@
 #include "memoryallocator.hpp"
 #include "memoryallocatorunittest.hpp"
+#include "memoryusageobserver.hpp"
 #include "helpers.hpp"
 #include "log.hpp"
Index: src/unittests/stackclassunittest.cpp
===================================================================
--- src/unittests/stackclassunittest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/stackclassunittest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -37,5 +37,4 @@
   Stack->ClearStack();
   delete(Stack);
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
 };
Index: src/unittests/tesselation_boundarytriangleunittest.cpp
===================================================================
--- src/unittests/tesselation_boundarytriangleunittest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/tesselation_boundarytriangleunittest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -37,19 +37,16 @@
   tesselpoints[0] = new TesselPoint;
   tesselpoints[0]->node = new Vector(0., 0., 0.);
-  tesselpoints[0]->Name = Malloc<char>(3, "TesselationBoundaryTriangleTest::setUp - *Name");
-  strcpy(tesselpoints[0]->Name, "1");
+  tesselpoints[0]->setName("1");
   tesselpoints[0]->nr = 1;
   points[0] = new BoundaryPointSet(tesselpoints[0]);
   tesselpoints[1] = new TesselPoint;
   tesselpoints[1]->node = new Vector(0., 1., 0.);
-  tesselpoints[1]->Name = Malloc<char>(3, "TesselationBoundaryTriangleTest::setUp - *Name");
-  strcpy(tesselpoints[1]->Name, "2");
+  tesselpoints[1]->setName("2");
   tesselpoints[1]->nr = 2;
   points[1] = new BoundaryPointSet(tesselpoints[1]);
   tesselpoints[2] = new TesselPoint;
-  tesselpoints[2] ->node = new Vector(1., 0., 0.);
-  tesselpoints[2] ->Name = Malloc<char>(3, "TesselationBoundaryTriangleTest::setUp - *Name");
-  strcpy(tesselpoints[2] ->Name, "3");
-  tesselpoints[2] ->nr = 3;
+  tesselpoints[2]->node = new Vector(1., 0., 0.);
+  tesselpoints[2]->setName("3");
+  tesselpoints[2]->nr = 3;
   points[2] = new BoundaryPointSet(tesselpoints[2] );
 
@@ -73,5 +70,4 @@
     delete tesselpoints[i];
   }
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
   errorLogger::purgeInstance();
Index: src/unittests/tesselation_insideoutsideunittest.cpp
===================================================================
--- src/unittests/tesselation_insideoutsideunittest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/tesselation_insideoutsideunittest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -38,48 +38,40 @@
   Walker = new TesselPoint;
   Walker->node = new Vector(0., 0., 0.);
-  Walker->Name = Malloc<char>(3, "TesselationInOutsideTest::setUp - *Name");
-  strcpy(Walker->Name, "1");
+  Walker->setName("1");
   Walker->nr = 1;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(0., 1., 0.);
-  Walker->Name = Malloc<char>(3, "TesselationInOutsideTest::setUp - *Name");
-  strcpy(Walker->Name, "2");
+  Walker->setName("2");
   Walker->nr = 2;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(1., 0., 0.);
-  Walker->Name = Malloc<char>(3, "TesselationInOutsideTest::setUp - *Name");
-  strcpy(Walker->Name, "3");
+  Walker->setName("3");
   Walker->nr = 3;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(1., 1., 0.);
-  Walker->Name = Malloc<char>(3, "TesselationInOutsideTest::setUp - *Name");
-  strcpy(Walker->Name, "4");
+  Walker->setName("4");
   Walker->nr = 4;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(0., 0., 1.);
-  Walker->Name = Malloc<char>(3, "TesselationInOutsideTest::setUp - *Name");
-  strcpy(Walker->Name, "5");
+  Walker->setName("5");
   Walker->nr = 5;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(0., 1., 1.);
-  Walker->Name = Malloc<char>(3, "TesselationInOutsideTest::setUp - *Name");
-  strcpy(Walker->Name, "6");
+  Walker->setName("6");
   Walker->nr = 6;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(1., 0., 1.);
-  Walker->Name = Malloc<char>(3, "TesselationInOutsideTest::setUp - *Name");
-  strcpy(Walker->Name, "7");
+  Walker->setName("7");
   Walker->nr = 7;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(1., 1., 1.);
-  Walker->Name = Malloc<char>(3, "TesselationInOutsideTest::setUp - *Name");
-  strcpy(Walker->Name, "8");
+  Walker->setName("8");
   Walker->nr = 8;
   Corners.push_back(Walker);
@@ -142,5 +134,4 @@
   }
   Corners.clear();
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
   errorLogger::purgeInstance();
Index: src/unittests/tesselationunittest.cpp
===================================================================
--- src/unittests/tesselationunittest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/tesselationunittest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -37,24 +37,20 @@
   Walker = new TesselPoint;
   Walker->node = new Vector(1., 0., -1.);
-  Walker->Name = Malloc<char>(3, "TesselationTest::setUp");
-  strcpy(Walker->Name, "1");
+  Walker->setName("1");
   Walker->nr = 1;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(-1., 1., -1.);
-  Walker->Name = Malloc<char>(3, "TesselationTest::setUp");
-  strcpy(Walker->Name, "2");
+  Walker->setName("2");
   Walker->nr = 2;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(-1., -1., -1.);
-  Walker->Name = Malloc<char>(3, "TesselationTest::setUp");
-  strcpy(Walker->Name, "3");
+  Walker->setName("3");
   Walker->nr = 3;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
   Walker->node = new Vector(-1., 0., 1.);
-  Walker->Name = Malloc<char>(3, "TesselationTest::setUp");
-  strcpy(Walker->Name, "4");
+  Walker->setName("4");
   Walker->nr = 4;
   Corners.push_back(Walker);
@@ -110,5 +106,4 @@
   }
   Corners.clear();
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
   errorLogger::purgeInstance();
Index: src/unittests/vectorunittest.cpp
===================================================================
--- src/unittests/vectorunittest.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/unittests/vectorunittest.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -49,5 +49,4 @@
 void VectorTest::tearDown()
 {
-  MemoryUsageObserver::purgeInstance();
   logger::purgeInstance();
   errorLogger::purgeInstance();
Index: src/vector.cpp
===================================================================
--- src/vector.cpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/vector.cpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -266,7 +266,7 @@
  * \return distance to plane
  */
-double Vector::DistanceToPlane(const Vector &PlaneNormal, const Vector &PlaneOffset) const
-{
-  return GetDistanceVectorToPlane(PlaneNormal,PlaneOffset).Norm();
+double Vector::DistanceToSpace(const Space &space) const
+{
+  return space.distance(*this);
 };
 
@@ -543,5 +543,5 @@
   // truncate to [0,1] for each axis
   for (int i=0;i<NDIM;i++) {
-    x[i] += 0.5;  // set to center of box
+    //x[i] += 0.5;  // set to center of box
     while (x[i] >= 1.)
       x[i] -= 1.;
Index: src/vector.hpp
===================================================================
--- src/vector.hpp	(revision b0e9c9b269a10c150b013b7fb592c9bf4771717b)
+++ src/vector.hpp	(revision 4ed18b5079e3f4ea8a189543a78e279bb579b049)
@@ -40,5 +40,5 @@
   double DistanceSquared(const Vector &y) const;
   Vector GetDistanceVectorToPlane(const Vector &PlaneNormal, const Vector &PlaneOffset) const;
-  double DistanceToPlane(const Vector &PlaneNormal, const Vector &PlaneOffset) const;
+  double DistanceToSpace(const Space& space) const;
   double PeriodicDistance(const Vector &y, const double * const cell_size) const;
   double PeriodicDistanceSquared(const Vector &y, const double * const cell_size) const;
