Index: src/config.cpp
===================================================================
--- src/config.cpp	(revision a5551b36831494b1f744d79223d87e97b7be6f5c)
+++ src/config.cpp	(revision c9bce3e4e4e06fbd3b6aa0303bb22113e04c7c27)
@@ -1055,77 +1055,12 @@
   // 3. parse the molecule in
   LoadMolecule(mol, FileBuffer, periode, FastParsing);
-  //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 (the following construct is needed to have the atoms not in the order of the DFS, but in
-  // the original one as parsed in)
-  // TODO: Optimize this, when molecules just contain pointer list of global atoms!
-
-  // 6a. create array of molecules to fill
-  const int MolCount = Subgraphs->next->Count();
-  molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules");
-  for (int i=0;i<MolCount;i++) {
-    molecules[i] = (molecule*) new molecule(periode);
-    molecules[i]->ActiveFlag = true;
-    MolList->insert(molecules[i]);
-  }
-
-  // 6b. 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;
-  atom *Walker = NULL;
-  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;
-    }
-    FragmentCounter++;
-  }
-
-  // 6c. relocate atoms to new molecules and remove from Leafs
-  Walker = mol->start;
-  while (mol->start->next != mol->end) {
-    Walker = mol->start->next;
-    if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) {
-      cerr << "Index of atom " << *Walker << " is invalid!" << endl;
-      performCriticalExit();
-    }
-    FragmentCounter = MolMap[Walker->nr];
-    if (FragmentCounter != 0) {
-      cout << Verbose(3) << "Re-linking " << *Walker << "..." << endl;
-      unlink(Walker);
-      molecules[FragmentCounter-1]->AddAtom(Walker);    // counting starts at 1
-    } else {
-      cerr << "Atom " << *Walker << " not associated to molecule!" << endl;
-      performCriticalExit();
-    }
-  }
-  // 6d. we don't need to redo bonds, as they are connected subgraphs and still maintained their ListOfBonds
-  // 6e. free Leafs
-  MolecularWalker = Subgraphs;
-  while (MolecularWalker->next != NULL) {
-    MolecularWalker = MolecularWalker->next;
-    delete(MolecularWalker->previous);
-  }
-  delete(MolecularWalker);
+
+  // 4. split into connected subgraphs
+  MolList->DissectMoleculeIntoConnectedSubgraphs((ofstream *)&cout, mol, this);
+
   delete(mol);
-  Free(&MolMap);
-  Free(&molecules);
-  cout << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl;
-
   delete(FileBuffer);
 };
+
 
 /** Initializes config file structure by loading elements from a give file with old pcp syntax.
Index: src/molecule.hpp
===================================================================
--- src/molecule.hpp	(revision a5551b36831494b1f744d79223d87e97b7be6f5c)
+++ src/molecule.hpp	(revision c9bce3e4e4e06fbd3b6aa0303bb22113e04c7c27)
@@ -321,4 +321,5 @@
   void Enumerate(ofstream *out);
   void Output(ofstream *out);
+  void DissectMoleculeIntoConnectedSubgraphs(ofstream * const out, molecule * const mol, config * const configuration);
 
   // merging of molecules
Index: src/moleculelist.cpp
===================================================================
--- src/moleculelist.cpp	(revision a5551b36831494b1f744d79223d87e97b7be6f5c)
+++ src/moleculelist.cpp	(revision c9bce3e4e4e06fbd3b6aa0303bb22113e04c7c27)
@@ -734,4 +734,78 @@
 };
 
+/** Dissects given \a *mol into connected subgraphs and inserts them as new molecules but with old atoms into \a this.
+ * \param *out output stream for debugging
+ * \param *mol molecule with atoms to dissect
+ * \param *configuration config with BondGraph
+ */
+void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(ofstream * const out, molecule * const mol, config * const configuration)
+{
+  // 1. dissect the molecule into connected subgraphs
+  configuration ->BG->ConstructBondGraph(out, mol);
+
+  // 2. scan for connected subgraphs
+  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
+  class StackClass<bond *> *BackEdgeStack = NULL;
+  Subgraphs = mol->DepthFirstSearchAnalysis(out, BackEdgeStack);
+  delete(BackEdgeStack);
+
+  // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in
+  // the original one as parsed in)
+  // TODO: Optimize this, when molecules just contain pointer list of global atoms!
+
+  // 4a. create array of molecules to fill
+  const int MolCount = Subgraphs->next->Count();
+  molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules");
+  for (int i=0;i<MolCount;i++) {
+    molecules[i] = (molecule*) new molecule(mol->elemente);
+    molecules[i]->ActiveFlag = true;
+    insert(molecules[i]);
+  }
+
+  // 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;
+  atom *Walker = NULL;
+  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;
+    }
+    FragmentCounter++;
+  }
+
+  // 4c. relocate atoms to new molecules and remove from Leafs
+  Walker = mol->start;
+  while (mol->start->next != mol->end) {
+    Walker = mol->start->next;
+    if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) {
+      cerr << "Index of atom " << *Walker << " is invalid!" << endl;
+      performCriticalExit();
+    }
+    FragmentCounter = MolMap[Walker->nr];
+    if (FragmentCounter != 0) {
+      cout << Verbose(3) << "Re-linking " << *Walker << "..." << endl;
+      unlink(Walker);
+      molecules[FragmentCounter-1]->AddAtom(Walker);    // counting starts at 1
+    } else {
+      cerr << "Atom " << *Walker << " not associated to molecule!" << endl;
+      performCriticalExit();
+    }
+  }
+  // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintained their ListOfBonds
+  // 4e. free Leafs
+  MolecularWalker = Subgraphs;
+  while (MolecularWalker->next != NULL) {
+    MolecularWalker = MolecularWalker->next;
+    delete(MolecularWalker->previous);
+  }
+  delete(MolecularWalker);
+  Free(&MolMap);
+  Free(&molecules);
+  cout << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl;
+};
 
 /******************************************* Class MoleculeLeafClass ************************************************/
