Index: src/bondgraph.cpp
===================================================================
--- src/bondgraph.cpp	(revision 2aeefd42484e1e703a9a9d84d548ce716faed02b)
+++ src/bondgraph.cpp	(revision ae38fb1ebb7a0ba407983519fa0603e09a65d217)
@@ -13,4 +13,5 @@
 #include "molecule.hpp"
 #include "parser.hpp"
+#include "periodentafel.hpp"
 #include "vector.hpp"
 
@@ -18,5 +19,5 @@
  * This classes contains typical bond lengths and thus may be used to construct a bond graph for a given molecule.
  */
-BondGraph::BondGraph(bool IsA) : BondLengthMatrix(NULL), IsAngstroem(IsA)
+BondGraph::BondGraph(bool IsA) : BondLengthMatrix(NULL), max_distance(0), IsAngstroem(IsA)
 {
 };
@@ -104,4 +105,23 @@
 };
 
+/** Determines the maximum of all element::CovalentRadius.
+ * \param *out output stream for debugging
+ * \param *periode periodentafel with all elements.
+ */
+double BondGraph::SetMaxDistanceToMaxOfCovalentRadii(ofstream * const out, const periodentafel * const periode)
+{
+  max_distance = 0.;
+
+  element * Runner = periode->start;
+  while (Runner->next != periode->end) {
+    Runner = Runner->next;
+    if (Runner->CovalentRadius > max_distance)
+      max_distance = Runner->CovalentRadius;
+  }
+  max_distance *= 2.;
+
+  return max_distance;
+};
+
 /** Returns bond criterion for given pair based on covalent radius.
  * \param *Walker first BondedParticle
Index: src/bondgraph.hpp
===================================================================
--- src/bondgraph.hpp	(revision 2aeefd42484e1e703a9a9d84d548ce716faed02b)
+++ src/bondgraph.hpp	(revision ae38fb1ebb7a0ba407983519fa0603e09a65d217)
@@ -23,4 +23,5 @@
 
 class molecule;
+class periodentafel;
 class MatrixContainer;
 
@@ -37,4 +38,5 @@
   bool ConstructBondGraph(ofstream * const out, molecule * const mol);
   double GetBondLength(int firstelement, int secondelement);
+  double SetMaxDistanceToMaxOfCovalentRadii(ofstream * const out, const periodentafel * const periode);
 
   void BondLengthMatrixMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem);
Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision 2aeefd42484e1e703a9a9d84d548ce716faed02b)
+++ src/builder.cpp	(revision ae38fb1ebb7a0ba407983519fa0603e09a65d217)
@@ -1250,5 +1250,5 @@
   // translate each to its center and merge all molecules in MoleculeListClass into this molecule
   int N = molecules->ListOfMolecules.size();
-  int *src = new int(N);
+  int *src = new int[N];
   N=0;
   for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
@@ -1257,5 +1257,5 @@
   }
   molecules->SimpleMultiAdd(mol, src, N);
-  delete(src);
+  delete[](src);
 
   // ... and translate back
Index: src/config.cpp
===================================================================
--- src/config.cpp	(revision 2aeefd42484e1e703a9a9d84d548ce716faed02b)
+++ src/config.cpp	(revision ae38fb1ebb7a0ba407983519fa0603e09a65d217)
@@ -1051,13 +1051,49 @@
   } else {
     cout << Verbose(0) << "Bond length table loading failed." << endl;
+    BG->SetMaxDistanceToMaxOfCovalentRadii((ofstream *)&cout, periode);
   }
 
   // 3. parse the molecule in
   LoadMolecule(mol, FileBuffer, periode, FastParsing);
-  mol->ActiveFlag = true;
-  MolList->insert(mol);
+  //mol->ActiveFlag = true;
+  //MolList->insert(mol);
 
   // 4. dissect the molecule into connected subgraphs
   BG->ConstructBondGraph((ofstream *)&cout, mol);
+
+  // 5. scan for connected subgraphs
+  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
+  class StackClass<bond *> *BackEdgeStack = NULL;
+  Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, BackEdgeStack);
+  delete(BackEdgeStack);
+
+  // 6. dissect
+  atom ***ListOfLocalAtoms = NULL;
+  int FragmentCounter = 0;
+  MoleculeLeafClass *MolecularWalker = Subgraphs;
+  atom *Walker = NULL;
+  while (MolecularWalker->next != NULL) {
+    MolecularWalker = MolecularWalker->next;
+    // fill the bond structure of the individually stored subgraphs (goes through whole chained list by itself)
+    MolecularWalker->FillBondStructureFromReference((ofstream *)&cout, mol, FragmentCounter, ListOfLocalAtoms, false);  // we don't want to keep the created ListOfLocalAtoms
+    FragmentCounter++;
+    MolecularWalker->Leaf->ActiveFlag = true;
+    Walker = MolecularWalker->Leaf->start;
+    while (Walker->next != MolecularWalker->Leaf->end) {
+      Walker = Walker->next;
+      Walker->father = Walker;
+    }
+    MolList->insert(MolecularWalker->Leaf);
+    MolecularWalker->Leaf = NULL; // don't remove molecule when deleting MolecularWalker
+    delete(MolecularWalker->previous);
+  }
+  delete(MolecularWalker);
+  for (int i=0;i<FragmentCounter;i++)
+    Free(&ListOfLocalAtoms[i]);
+  Free(&ListOfLocalAtoms);
+  cout << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl;
+
+  // 6. free parsed in molecule
+  delete(mol);
 
   delete(FileBuffer);
Index: src/molecule_graph.cpp
===================================================================
--- src/molecule_graph.cpp	(revision 2aeefd42484e1e703a9a9d84d548ce716faed02b)
+++ src/molecule_graph.cpp	(revision ae38fb1ebb7a0ba407983519fa0603e09a65d217)
@@ -114,16 +114,22 @@
   *out << Verbose(0) << "Begin of CreateAdjacencyList." << endl;
   // remove every bond from the list
-  if ((first->next != last) && (last->previous != first)) { // there are bonds present
-    cleanup(first, last);
+  bond *Binder = NULL;
+  while (last->previous != first) {
+    Binder = last->previous;
+    Binder->leftatom->UnregisterBond(Binder);
+    Binder->rightatom->UnregisterBond(Binder);
+    removewithoutcheck(Binder);
   }
 
   // count atoms in molecule = dimension of matrix (also give each unique name and continuous numbering)
   CountAtoms(out);
-  *out << Verbose(1) << "AtomCount " << AtomCount << "." << endl;
+  *out << Verbose(1) << "AtomCount " << AtomCount << " and bonddistance is " << bonddistance << "." << endl;
 
   if ((AtomCount > 1) && (bonddistance > 1.)) {
+    *out << Verbose(2) << "Creating Linked Cell structure ... " << endl;
     LC = new LinkedCell(this, bonddistance);
 
     // create a list to map Tesselpoint::nr to atom *
+    *out << Verbose(2) << "Creating TesselPoint to atom map ... " << endl;
     AtomMap = Calloc<atom *> (AtomCount, "molecule::CreateAdjacencyList - **AtomCount");
     Walker = start;
@@ -134,4 +140,5 @@
 
     // 3a. go through every cell
+    *out << Verbose(2) << "Celling ... " << endl;
     for (LC->n[0] = 0; LC->n[0] < LC->N[0]; LC->n[0]++)
       for (LC->n[1] = 0; LC->n[1] < LC->N[1]; LC->n[1]++)
@@ -175,4 +182,5 @@
 
     // correct bond degree by comparing valence and bond degree
+    *out << Verbose(2) << "Correcting bond degree ... " << endl;
     CorrectBondDegree(out);
 
Index: src/moleculelist.cpp
===================================================================
--- src/moleculelist.cpp	(revision 2aeefd42484e1e703a9a9d84d548ce716faed02b)
+++ src/moleculelist.cpp	(revision ae38fb1ebb7a0ba407983519fa0603e09a65d217)
@@ -12,4 +12,5 @@
 #include "helpers.hpp"
 #include "linkedcell.hpp"
+#include "lists.hpp"
 #include "molecule.hpp"
 #include "memoryallocator.hpp"
@@ -829,6 +830,14 @@
 
   if (status) {
-    *out << Verbose(1) << "Creating adjacency list for subgraph " << this
-        << "." << endl;
+    *out << 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) {
@@ -847,8 +856,4 @@
       }
     }
-//    FragmentCounter++;
-//    if (next != NULL)
-//      status = next->FillBondStructureFromReference(out, reference, FragmentCounter, ListOfLocalAtoms);
-//    FragmentCounter--;
   }
 
@@ -916,12 +921,12 @@
   bool status = true;
 
-  int Counter = Count();
   if (ListOfLocalAtoms == NULL) { // allocated initial pointer
     // allocate and set each field to NULL
+    const int Counter = Count();
     ListOfLocalAtoms = Calloc<atom**>(Counter, "MoleculeLeafClass::FillListOfLocalAtoms - ***ListOfLocalAtoms");
-    if (ListOfLocalAtoms != NULL) {
-      FreeList = FreeList && true;
-    } else
+    if (ListOfLocalAtoms == NULL) {
+      FreeList = FreeList && false;
       status = false;
+    }
   }
 
