Index: src/Actions/FragmentationAction/DepthFirstSearchAction.cpp
===================================================================
--- src/Actions/FragmentationAction/DepthFirstSearchAction.cpp	(revision e73ad9a5d1596d6e9a9f9c6a17bf256479595404)
+++ src/Actions/FragmentationAction/DepthFirstSearchAction.cpp	(revision 49c059c36d49bc80016beb5b2ba5a56947f5f28c)
@@ -26,4 +26,5 @@
 #include "CodePatterns/Verbose.hpp"
 #include "Graph/CyclicStructureAnalysis.hpp"
+#include "Graph/DepthFirstSearchAnalysis.hpp"
 #include "molecule.hpp"
 #include "Descriptors/MoleculeDescriptor.hpp"
@@ -47,10 +48,10 @@
 
   DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl);
-  molecule * const mol = World::getInstance().getMolecule(MoleculeById(0));
-  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
   atom **ListOfAtoms = NULL;
-  std::deque<bond *> *BackEdgeStack = NULL;
   std::deque<bond *> *LocalBackEdgeStack = NULL;
-  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
+  DepthFirstSearchAnalysis DFS;
+  DFS();
+  DFS.UpdateMoleculeStructure();
+  MoleculeLeafClass *Subgraphs = DFS.getMoleculeStructure();
   if (Subgraphs != NULL) {
     int FragmentCounter = 0;
@@ -58,17 +59,18 @@
       Subgraphs = Subgraphs->next;
       ListOfAtoms = NULL;
-      Subgraphs->Leaf->FillBondStructureFromReference(mol, ListOfAtoms, false);  // we want to keep the created ListOfLocalAtoms
+      Subgraphs->Leaf->FillListOfLocalAtoms(ListOfAtoms, Subgraphs->Leaf->getAtomCount());
       LocalBackEdgeStack = new std::deque<bond *>; // no need to have it Subgraphs->Leaf->BondCount size
-      Subgraphs->Leaf->PickLocalBackEdges(ListOfAtoms, BackEdgeStack, LocalBackEdgeStack);
+      DFS.PickLocalBackEdges(ListOfAtoms, LocalBackEdgeStack);
       CyclicStructureAnalysis CycleAnalysis;
       CycleAnalysis(LocalBackEdgeStack);
       delete(LocalBackEdgeStack);
+      Subgraphs->Leaf = NULL;
       delete(Subgraphs->previous);
-      delete[](ListOfAtoms);  // and here we remove it
+      delete[](ListOfAtoms);  // allocated by FillListOfLocalAtoms
       FragmentCounter++;
     }
+    Subgraphs->Leaf = NULL;
     delete(Subgraphs);
   }
-  delete(BackEdgeStack);
   return Action::success;
 }
Index: src/Actions/FragmentationAction/FragmentationAction.cpp
===================================================================
--- src/Actions/FragmentationAction/FragmentationAction.cpp	(revision e73ad9a5d1596d6e9a9f9c6a17bf256479595404)
+++ src/Actions/FragmentationAction/FragmentationAction.cpp	(revision 49c059c36d49bc80016beb5b2ba5a56947f5f28c)
@@ -25,4 +25,5 @@
 #include "CodePatterns/Log.hpp"
 #include "CodePatterns/Verbose.hpp"
+#include "Graph/DepthFirstSearchAnalysis.hpp"
 #include "molecule.hpp"
 #include "Descriptors/MoleculeDescriptor.hpp"
@@ -48,17 +49,17 @@
   getParametersfromValueStorage();
 
+  DepthFirstSearchAnalysis DFS;
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     mol = iter->second;
     ASSERT(mol != NULL, "No molecule has been picked for fragmentation.");
-    DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with bond distance " << params.distance << " angstroem, order of " << params.order << "." << endl);
-    DoLog(0) && (Log() << Verbose(0) << "Creating connection matrix..." << endl);
+    LOG(2, "INFO: Fragmenting molecule with bond distance " << params.distance << " angstroem, order of " << params.order << ".");
     start = clock();
-    DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);
     if (mol->hasBondStructure()) {
-      ExitFlag = mol->FragmentMolecule(params.order, params.path);
+      LOG(1, "STAUS: Fragmenting molecule with current connection matrix ...");
+      ExitFlag = mol->FragmentMolecule(params.order, params.path, DFS);
     }
     World::getInstance().setExitFlag(ExitFlag);
     end = clock();
-    DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);
+    LOG(0, "STATUS: Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s.");
   }
   return Action::success;
Index: src/Actions/FragmentationAction/SubgraphDissectionAction.cpp
===================================================================
--- src/Actions/FragmentationAction/SubgraphDissectionAction.cpp	(revision e73ad9a5d1596d6e9a9f9c6a17bf256479595404)
+++ src/Actions/FragmentationAction/SubgraphDissectionAction.cpp	(revision 49c059c36d49bc80016beb5b2ba5a56947f5f28c)
@@ -29,4 +29,5 @@
 #include "CodePatterns/Verbose.hpp"
 #include "Graph/BondGraph.hpp"
+#include "Graph/DepthFirstSearchAnalysis.hpp"
 #include "molecule.hpp"
 #include "World.hpp"
@@ -102,10 +103,8 @@
 
   // 2. scan for connected subgraphs
-  LOG(0, "STATUS: Analysing adjacency graph.");
-  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
-  std::deque<bond *> *BackEdgeStack = NULL;
-  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
-  delete(BackEdgeStack);
-  if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {
+  DepthFirstSearchAnalysis DFS;
+  DFS();
+  DFS.UpdateMoleculeStructure();
+  if (!World::getInstance().numMolecules()) {
     //World::getInstance().destroyMolecule(mol);
     DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms." << endl);
@@ -113,59 +112,5 @@
   }
 
-  //int FragmentCounter = Subgraphs->next->Count();
-
-  // TODO: When DepthFirstSearchAnalysis does not use AddCopyAtom() anymore, we don't need to delete all original atoms
-  LOG(0, "STATUS: Creating molecules as connected subgraphs.");
-  {
-    {
-      atom **ListOfAtoms = NULL;
-      // 3a. re-create bond structure and insert molecules into general MoleculeListClass
-      MoleculeLeafClass *MoleculeWalker = Subgraphs->next;
-      while (MoleculeWalker->next != NULL) {
-        ListOfAtoms = NULL;
-        MoleculeWalker->Leaf->FillBondStructureFromReference(mol, ListOfAtoms, true);  // we want to keep the created ListOfLocalAtoms
-        molecules->insert(MoleculeWalker->Leaf);
-        MoleculeWalker = MoleculeWalker->next;
-      }
-      molecules->insert(MoleculeWalker->Leaf);
-      ListOfAtoms = NULL;
-      MoleculeWalker->Leaf->FillBondStructureFromReference(mol, ListOfAtoms, true);  // we want to keep the created ListOfLocalAtoms
-    }
-
-    // 3b. store map from new to old ids for 3d
-    vector <atom *> allatoms = World::getInstance().getAllAtoms();
-    AtomAtomList newtooldlist;
-    for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner)
-      if ((*AtomRunner)->father != (*AtomRunner))
-        newtooldlist.insert( std::pair<atomId_t, atomId_t> ((*AtomRunner)->getId(),(*AtomRunner)->father->getId()) );
-
-    {
-      // 3c. destroy the original molecule
-      for (molecule::iterator AtomRunner = mol->begin(); !mol->empty(); AtomRunner = mol->begin())
-        World::getInstance().destroyAtom(*AtomRunner);
-      World::getInstance().destroyMolecule(mol);
-    }
-
-    {
-      // 3d. convert to old Ids and correct fathers (AddCopyAtom sets father to original atom, which has been destroyed).
-      vector <atom *> allatoms = World::getInstance().getAllAtoms();
-      for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
-        World::getInstance().changeAtomId((*AtomRunner)->getId(), newtooldlist[(*AtomRunner)->getId()]);
-        (*AtomRunner)->father = *AtomRunner;
-      }
-    }
-  }
-
-  // 4. free Leafs
-  LOG(0, "STATUS: Done.");
-  MoleculeLeafClass *MolecularWalker = Subgraphs;
-  while (MolecularWalker->next != NULL) {
-    MolecularWalker->Leaf = NULL;
-    MolecularWalker = MolecularWalker->next;
-    delete(MolecularWalker->previous);
-  }
-  MolecularWalker->Leaf = NULL;
-  delete(MolecularWalker);
-  DoLog(1) && (Log() << Verbose(1) << "I scanned " << molecules->ListOfMolecules.size() << " molecules." << endl);
+  DoLog(1) && (Log() << Verbose(1) << "I scanned " << World::getInstance().numMolecules() << " molecules." << endl);
 
   return Action::state_ptr(UndoState);
