Index: configure.ac
===================================================================
--- configure.ac	(revision 99752ac32a6b5b4b90ea6288654d966ac4421175)
+++ configure.ac	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
@@ -221,4 +221,5 @@
 	src/Actions/Makefile
 	src/Exceptions/Makefile
+  src/Graph/Makefile
 	src/LinearAlgebra/Makefile
 	src/Parser/Makefile
Index: src/Graph/BreadthFirstSearchAdd.cpp
===================================================================
--- src/Graph/BreadthFirstSearchAdd.cpp	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
+++ src/Graph/BreadthFirstSearchAdd.cpp	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
@@ -0,0 +1,169 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * BreadthFirstSearchAdd.cpp
+ *
+ *  Created on: Feb 16, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "BreadthFirstSearchAdd.hpp"
+
+#include "atom.hpp"
+#include "bond.hpp"
+#include "CodePatterns/Assert.hpp"
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "CodePatterns/Verbose.hpp"
+#include "molecule.hpp"
+#include "World.hpp"
+
+
+BreadthFirstSearchAdd::BreadthFirstSearchAdd(atom *&_Root, int _BondOrder, bool _IsAngstroem) :
+  BondOrder(_BondOrder),
+  Root(_Root),
+  IsAngstroem(_IsAngstroem)
+{
+  BFSStack.push_front(Root);
+}
+
+
+BreadthFirstSearchAdd::~BreadthFirstSearchAdd()
+{}
+
+void BreadthFirstSearchAdd::Init(atom *&_Root, int _BondOrder)
+{
+  BondOrder = _BondOrder;
+  Root = _Root;
+  BFSStack.clear();
+  BFSStack.push_front(Root);
+}
+
+void BreadthFirstSearchAdd::InitNode(atomId_t atom_id)
+{
+  PredecessorList[atom_id] = NULL;
+  ShortestPathList[atom_id] = -1;
+  if (AddedAtomList.find(atom_id) != AddedAtomList.end()) // mark already present atoms (i.e. Root and maybe others) as visited
+    ColorList[atom_id] = bond::lightgray;
+  else
+    ColorList[atom_id] = bond::white;
+}
+
+
+void BreadthFirstSearchAdd::UnvisitedNode(molecule *Mol, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond)
+{
+  if (Binder != Bond) // let other atom bond::white if it's via Root bond. In case it's cyclic it has to be reached again (yet Root is from OtherAtom already bond::black, thus no problem)
+    ColorList[OtherAtom->getNr()] = bond::lightgray;
+  PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor
+  ShortestPathList[OtherAtom->getNr()] = ShortestPathList[Walker->getNr()] + 1;
+  DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " " << Binder->GetColor(ColorList[OtherAtom->getNr()]) << ", its predecessor is " << Walker->getName() << " and its Shortest Path is " << ShortestPathList[OtherAtom->getNr()] << " egde(s) long." << endl);
+  if ((((ShortestPathList[OtherAtom->getNr()] < BondOrder) && (Binder != Bond)))) { // Check for maximum distance
+    DoLog(3) && (Log() << Verbose(3));
+    if (AddedAtomList[OtherAtom->getNr()] == NULL) { // add if it's not been so far
+      AddedAtomList[OtherAtom->getNr()] = Mol->AddCopyAtom(OtherAtom);
+      DoLog(0) && (Log() << Verbose(0) << "Added OtherAtom " << OtherAtom->getName());
+      AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], Binder);
+      DoLog(0) && (Log() << Verbose(0) << " and bond " << *(AddedBondList[Binder->nr]) << ", ");
+    } else { // this code should actually never come into play (all bond::white atoms are not yet present in BondMolecule, that's why they are bond::white in the first place)
+      DoLog(0) && (Log() << Verbose(0) << "Not adding OtherAtom " << OtherAtom->getName());
+      if (AddedBondList[Binder->nr] == NULL) {
+        AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], Binder);
+        DoLog(0) && (Log() << Verbose(0) << ", added Bond " << *(AddedBondList[Binder->nr]));
+      } else
+        DoLog(0) && (Log() << Verbose(0) << ", not added Bond ");
+    }
+    DoLog(0) && (Log() << Verbose(0) << ", putting OtherAtom into queue." << endl);
+    BFSStack.push_front(OtherAtom);
+  } else { // out of bond order, then replace
+    if ((AddedAtomList[OtherAtom->getNr()] == NULL) && (Binder->Cyclic))
+      ColorList[OtherAtom->getNr()] = bond::white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic)
+    if (Binder == Bond)
+      DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is the Root bond");
+    else if (ShortestPathList[OtherAtom->getNr()] >= BondOrder)
+      DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is out of Bond Count of " << BondOrder);
+    if (!Binder->Cyclic)
+      DoLog(0) && (Log() << Verbose(0) << ", is not part of a cyclic bond, saturating bond with Hydrogen." << endl);
+    if (AddedBondList[Binder->nr] == NULL) {
+      if ((AddedAtomList[OtherAtom->getNr()] != NULL)) { // .. whether we add or saturate
+        AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], Binder);
+      } else {
+#ifdef ADDHYDROGEN
+        if (!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->getNr()], Walker, OtherAtom, IsAngstroem))
+        exit(1);
+#endif
+      }
+    }
+  }
+}
+
+
+void BreadthFirstSearchAdd::VisitedNode(molecule *Mol, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond)
+{
+  DoLog(3) && (Log() << Verbose(3) << "Not Adding, has already been visited." << endl);
+  // This has to be a cyclic bond, check whether it's present ...
+  if (AddedBondList[Binder->nr] == NULL) {
+    if ((Binder != Bond) && (Binder->Cyclic) && (((ShortestPathList[Walker->getNr()] + 1) < BondOrder))) {
+      AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], Binder);
+    } else { // if it's root bond it has to broken (otherwise we would not create the fragments)
+#ifdef ADDHYDROGEN
+      if(!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->getNr()], Walker, OtherAtom, IsAngstroem))
+      exit(1);
+#endif
+    }
+  }
+}
+
+
+void BreadthFirstSearchAdd::operator()(molecule *Mol, atom *_Root, bond *Bond, int _BondOrder)
+{
+  Info FunctionInfo("BreadthFirstSearchAdd");
+  atom *Walker = NULL, *OtherAtom = NULL;
+  bond *Binder = NULL;
+
+  // add Root if not done yet
+  if (AddedAtomList[_Root->getNr()] == NULL) // add Root if not yet present
+    AddedAtomList[_Root->getNr()] = Mol->AddCopyAtom(_Root);
+
+  Init(_Root, _BondOrder);
+
+  // and go on ... Queue always contains all bond::lightgray vertices
+  while (!BFSStack.empty()) {
+    // we have to pop the oldest atom from stack. This keeps the atoms on the stack always of the same ShortestPath distance.
+    // e.g. if current atom is 2, push to end of stack are of length 3, but first all of length 2 would be popped. They again
+    // append length of 3 (their neighbours). Thus on stack we have always atoms of a certain length n at bottom of stack and
+    // followed by n+1 till top of stack.
+    Walker = BFSStack.front(); // pop oldest added
+    BFSStack.pop_front();
+    const BondList& ListOfBonds = Walker->getListOfBonds();
+    DoLog(1) && (Log() << Verbose(1) << "Current Walker is: " << Walker->getName() << ", and has " << ListOfBonds.size() << " bonds." << endl);
+    for (BondList::const_iterator Runner = ListOfBonds.begin();
+        Runner != 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->getName() << " for bond " << *(*Runner) << "." << endl);
+        if (ColorList[OtherAtom->getNr()] == bond::white) {
+          UnvisitedNode(Mol, Walker, OtherAtom, Binder, Bond);
+        } else {
+          VisitedNode(Mol, Walker, OtherAtom, Binder, Bond);
+        }
+      }
+    }
+    ColorList[Walker->getNr()] = bond::black;
+    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " bond::black." << endl);
+  }
+}
+
Index: src/Graph/BreadthFirstSearchAdd.hpp
===================================================================
--- src/Graph/BreadthFirstSearchAdd.hpp	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
+++ src/Graph/BreadthFirstSearchAdd.hpp	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
@@ -0,0 +1,77 @@
+/*
+ * BreadthFirstSearchAdd.hpp
+ *
+ *  Created on: Feb 16, 2011
+ *      Author: heber
+ */
+
+#ifndef BREADTHFIRSTSEARCHADD_HPP_
+#define BREADTHFIRSTSEARCHADD_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <deque>
+#include <map>
+
+#include "Helpers/defs.hpp"
+#include "types.hpp"
+
+#include "bond.hpp"
+
+class atom;
+class molecule;
+
+class BreadthFirstSearchAdd
+{
+public:
+  BreadthFirstSearchAdd(atom *&_Root, int _BondOrder, bool _IsAngstroem);
+  ~BreadthFirstSearchAdd();
+
+  /** Reinitializes the structure for a new BFS run.
+   *
+   * @param _Root Root atom to start BFS from
+   * @param _BondOrder horizon in bond counts when to stop BFS
+   */
+  void Init(atom *&_Root, int _BondOrder);
+
+  /** Adds atoms up to \a BondCount distance from \a *Root and notes them down in \a AddedAtomList.
+   * Gray vertices are always enqueued in an std::deque<atom *> FIFO queue, the rest is usual BFS with adding vertices found was
+   * white and putting into queue.
+   * \param *Mol Molecule class to add atoms to
+   * \param *Root root vertex for BFS
+   * \param *Bond bond not to look beyond
+   * \param BondOrder maximum distance for vertices to add
+   * \param IsAngstroem lengths are in angstroem or bohrradii
+   */
+  void operator()(molecule *Mol, atom *_Root, bond *Bond, int _BondOrder);
+
+private:
+  void UnvisitedNode(molecule *Mol, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond);
+  void VisitedNode(molecule *Mol, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond);
+
+  /** initialise vertex as white with no predecessor, empty queue, color Root lightgray.
+   *
+   */
+  void InitNode(atomId_t atom_id);
+
+  std::map<atomId_t, atom *> PredecessorList;
+  std::map<atomId_t, int > ShortestPathList;
+  std::map<atomId_t, enum bond::Shading> ColorList;
+  std::deque<atom *> BFSStack;
+  int BondOrder;
+  atom *Root;
+
+  bool BackStepping;
+  int CurrentGraphNr;
+  int ComponentNr;
+  std::map<atomId_t, atom *> AddedAtomList;
+  std::map<int, bond *> AddedBondList;
+
+  bool IsAngstroem;
+};
+
+
+#endif /* BREADTHFIRSTSEARCHADD_HPP_ */
Index: src/Graph/Makefile.am
===================================================================
--- src/Graph/Makefile.am	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
+++ src/Graph/Makefile.am	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
@@ -0,0 +1,62 @@
+# PLEASE adhere to the alphabetical ordering in this Makefile!
+# Also indentation by a single tab
+
+INCLUDES = -I$(top_srcdir)/src
+
+AM_LDFLAGS = ${CodePatterns_LIBS} -ldl
+AM_CPPFLAGS = ${BOOST_CPPFLAGS} ${CodePatterns_CFLAGS}
+
+GRAPHSOURCE = \
+	BreadthFirstSearchAdd.cpp
+				  
+GRAPHHEADER = \
+	BreadthFirstSearchAdd.hpp
+
+
+lib_LTLIBRARIES = libMolecuilderGraph.la
+libMolecuilderGraph_la_includedir = $(includedir)/MoleCuilder/Graph/
+nobase_libMolecuilderGraph_la_include_HEADERS = ${GRAPHHEADER}
+
+## Define the source file list for the "libexample-@MOLECUILDER_API_VERSION@.la"
+## target.  Note that @MOLECUILDER_API_VERSION@ is not interpreted by Automake and
+## will therefore be treated as if it were literally part of the target name,
+## and the variable name derived from that.
+## The file extension .cc is recognized by Automake, and makes it produce
+## rules which invoke the C++ compiler to produce a libtool object file (.lo)
+## from each source file.  Note that it is not necessary to list header files
+## which are already listed elsewhere in a _HEADERS variable assignment.
+libMolecuilderGraph_la_SOURCES = ${GRAPHSOURCE}
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+libMolecuilderGraph_la_LDFLAGS = -version-info $(MOLECUILDER_SO_VERSION)
+
+## The generated configuration header is installed in its own subdirectory of
+## $(libdir).  The reason for this is that the configuration information put
+## into this header file describes the target platform the installed library
+## has been built for.  Thus the file must not be installed into a location
+## intended for architecture-independent files, as defined by the Filesystem
+## Hierarchy Standard (FHS).
+## The nodist_ prefix instructs Automake to not generate rules for including
+## the listed files in the distribution on 'make dist'.  Files that are listed
+## in _HEADERS variables are normally included in the distribution, but the
+## configuration header file is generated at configure time and should not be
+## shipped with the source tarball.
+#libMolecuilderGraph_libincludedir = $(libdir)/MoleCuilder/include
+#nodist_libMolecuilderGraph_libinclude_HEADERS = $(top_builddir)/libmolecuilder_config.h
+
+## Install the generated pkg-config file (.pc) into the expected location for
+## architecture-dependent package configuration information.  Occasionally,
+## pkg-config files are also used for architecture-independent data packages,
+## in which case the correct install location would be $(datadir)/pkgconfig.
+#pkgconfigdir = $(libdir)/pkgconfig
+#pkgconfig_DATA = $(top_builddir)/MoleCuilder.pc
+
+unity.cpp:
+	echo "" >  unity.cpp; \
+	list='$(GRAPHSOURCE)'; for file in $$list; do \
+	  echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
+	done;
+	
+MOSTLYCLEANFILES = unity.cpp
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 99752ac32a6b5b4b90ea6288654d966ac4421175)
+++ src/Makefile.am	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
@@ -8,4 +8,5 @@
 	LinearAlgebra \
 	Shapes \
+	Graph \
 	Actions \
 	UIElements
@@ -319,4 +320,5 @@
 	UIElements/libMolecuilderUI.la \
 	Actions/libMolecuilderActions.la \
+	Graph/libMolecuilderGraph.la \
 	libMolecuilder.la \
 	Parser/libMolecuilderParser.la \
@@ -340,4 +342,5 @@
 	UIElements/libMolecuilderQtUI.la \
 	Actions/libMolecuilderActions.la \
+	Graph/libMolecuilderGraph.la \
 	libMolecuilder.la \
 	Parser/libMolecuilderParser.la \
@@ -354,4 +357,5 @@
 	UIElements/libMolecuilderUI.la \
 	Actions/libMolecuilderActions.la \
+	Graph/libMolecuilderGraph.la \
 	libMolecuilder.la \
 	Parser/libMolecuilderParser.la \
@@ -367,4 +371,5 @@
 	UIElements/libMolecuilderUI.la \
 	Actions/libMolecuilderActions.la \
+	Graph/libMolecuilderGraph.la \
 	libMolecuilder.la \
 	Parser/libMolecuilderParser.la \
Index: src/molecule.hpp
===================================================================
--- src/molecule.hpp	(revision 99752ac32a6b5b4b90ea6288654d966ac4421175)
+++ src/molecule.hpp	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
@@ -214,5 +214,4 @@
   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
Index: src/molecule_graph.cpp
===================================================================
--- src/molecule_graph.cpp	(revision 99752ac32a6b5b4b90ea6288654d966ac4421175)
+++ src/molecule_graph.cpp	(revision 53d6b265421d71dfd6355f93fe27b0b06473194f)
@@ -1138,158 +1138,4 @@
 ;
 
-void BreadthFirstSearchAdd_Init(struct BFSAccounting &BFS, atom *&Root, int AtomCount, int BondOrder, atom **AddedAtomList = NULL)
-{
-  BFS.AtomCount = AtomCount;
-  BFS.BondOrder = BondOrder;
-  BFS.PredecessorList = new atom*[AtomCount];
-  BFS.ShortestPathList = new int[AtomCount];
-  BFS.ColorList = new enum bond::Shading[AtomCount];
-  BFS.BFSStack = new std::deque<atom *> (AtomCount);
-
-  BFS.Root = Root;
-  BFS.BFSStack->clear();
-  BFS.BFSStack->push_front(Root);
-
-  // 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
-      BFS.ColorList[i] = bond::lightgray;
-    else
-      BFS.ColorList[i] = bond::white;
-  }
-  //BFS.ShortestPathList[Root->getNr()] = 0; // done by Calloc
-}
-;
-
-void BreadthFirstSearchAdd_Free(struct BFSAccounting &BFS)
-{
-  delete[](BFS.PredecessorList);
-  delete[](BFS.ShortestPathList);
-  delete[](BFS.ColorList);
-  delete (BFS.BFSStack);
-  BFS.AtomCount = 0;
-}
-;
-
-void BreadthFirstSearchAdd_UnvisitedNode(molecule *Mol, struct BFSAccounting &BFS, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond, atom **&AddedAtomList, bond **&AddedBondList, bool IsAngstroem)
-{
-  if (Binder != Bond) // let other atom white if it's via Root bond. In case it's cyclic it has to be reached again (yet Root is from OtherAtom already black, thus no problem)
-    BFS.ColorList[OtherAtom->getNr()] = bond::lightgray;
-  BFS.PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor
-  BFS.ShortestPathList[OtherAtom->getNr()] = BFS.ShortestPathList[Walker->getNr()] + 1;
-  DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " " << ((BFS.ColorList[OtherAtom->getNr()] == bond::white) ? "white" : "lightgray") << ", its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->getNr()] << " egde(s) long." << endl);
-  if ((((BFS.ShortestPathList[OtherAtom->getNr()] < BFS.BondOrder) && (Binder != Bond)))) { // Check for maximum distance
-    DoLog(3) && (Log() << Verbose(3));
-    if (AddedAtomList[OtherAtom->getNr()] == NULL) { // add if it's not been so far
-      AddedAtomList[OtherAtom->getNr()] = Mol->AddCopyAtom(OtherAtom);
-      DoLog(0) && (Log() << Verbose(0) << "Added OtherAtom " << OtherAtom->getName());
-      AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], 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->getName());
-      if (AddedBondList[Binder->nr] == NULL) {
-        AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], Binder);
-        DoLog(0) && (Log() << Verbose(0) << ", added Bond " << *(AddedBondList[Binder->nr]));
-      } else
-        DoLog(0) && (Log() << Verbose(0) << ", not added Bond ");
-    }
-    DoLog(0) && (Log() << Verbose(0) << ", putting OtherAtom into queue." << endl);
-    BFS.BFSStack->push_front(OtherAtom);
-  } else { // out of bond order, then replace
-    if ((AddedAtomList[OtherAtom->getNr()] == NULL) && (Binder->Cyclic))
-      BFS.ColorList[OtherAtom->getNr()] = bond::white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic)
-    if (Binder == Bond)
-      DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is the Root bond");
-    else if (BFS.ShortestPathList[OtherAtom->getNr()] >= BFS.BondOrder)
-      DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is out of Bond Count of " << BFS.BondOrder);
-    if (!Binder->Cyclic)
-      DoLog(0) && (Log() << Verbose(0) << ", is not part of a cyclic bond, saturating bond with Hydrogen." << endl);
-    if (AddedBondList[Binder->nr] == NULL) {
-      if ((AddedAtomList[OtherAtom->getNr()] != NULL)) { // .. whether we add or saturate
-        AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], Binder);
-      } else {
-#ifdef ADDHYDROGEN
-        if (!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->getNr()], Walker, OtherAtom, IsAngstroem))
-        exit(1);
-#endif
-      }
-    }
-  }
-}
-;
-
-void BreadthFirstSearchAdd_VisitedNode(molecule *Mol, struct BFSAccounting &BFS, atom *&Walker, atom *&OtherAtom, bond *&Binder, bond *&Bond, atom **&AddedAtomList, bond **&AddedBondList, bool IsAngstroem)
-{
-  DoLog(3) && (Log() << Verbose(3) << "Not Adding, has already been visited." << endl);
-  // This has to be a cyclic bond, check whether it's present ...
-  if (AddedBondList[Binder->nr] == NULL) {
-    if ((Binder != Bond) && (Binder->Cyclic) && (((BFS.ShortestPathList[Walker->getNr()] + 1) < BFS.BondOrder))) {
-      AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->getNr()], AddedAtomList[OtherAtom->getNr()], Binder);
-    } else { // if it's root bond it has to broken (otherwise we would not create the fragments)
-#ifdef ADDHYDROGEN
-      if(!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->getNr()], Walker, OtherAtom, IsAngstroem))
-      exit(1);
-#endif
-    }
-  }
-}
-;
-
-/** Adds atoms up to \a BondCount distance from \a *Root and notes them down in \a **AddedAtomList.
- * Gray vertices are always enqueued in an std::deque<atom *> FIFO queue, the rest is usual BFS with adding vertices found was
- * white and putting into queue.
- * \param *Mol Molecule class to add atoms to
- * \param **AddedAtomList list with added atom pointers, index is atom father's number
- * \param **AddedBondList list with added bond pointers, index is bond father's number
- * \param *Root root vertex for BFS
- * \param *Bond bond not to look beyond
- * \param BondOrder maximum distance for vertices to add
- * \param IsAngstroem lengths are in angstroem or bohrradii
- */
-void molecule::BreadthFirstSearchAdd(molecule *Mol, atom **&AddedAtomList, bond **&AddedBondList, atom *Root, bond *Bond, int BondOrder, bool IsAngstroem)
-{
-  struct BFSAccounting BFS;
-  atom *Walker = NULL, *OtherAtom = NULL;
-  bond *Binder = NULL;
-
-  // add Root if not done yet
-  if (AddedAtomList[Root->getNr()] == NULL) // add Root if not yet present
-    AddedAtomList[Root->getNr()] = Mol->AddCopyAtom(Root);
-
-  BreadthFirstSearchAdd_Init(BFS, Root, BondOrder, getAtomCount(), AddedAtomList);
-
-  // and go on ... Queue always contains all lightgray vertices
-  while (!BFS.BFSStack->empty()) {
-    // we have to pop the oldest atom from stack. This keeps the atoms on the stack always of the same ShortestPath distance.
-    // e.g. if current atom is 2, push to end of stack are of length 3, but first all of length 2 would be popped. They again
-    // append length of 3 (their neighbours). Thus on stack we have always atoms of a certain length n at bottom of stack and
-    // followed by n+1 till top of stack.
-    Walker = BFS.BFSStack->front(); // pop oldest added
-    BFS.BFSStack->pop_front();
-    const BondList& ListOfBonds = Walker->getListOfBonds();
-    DoLog(1) && (Log() << Verbose(1) << "Current Walker is: " << Walker->getName() << ", and has " << ListOfBonds.size() << " bonds." << endl);
-    for (BondList::const_iterator Runner = ListOfBonds.begin();
-        Runner != 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->getName() << " for bond " << *(*Runner) << "." << endl);
-        if (BFS.ColorList[OtherAtom->getNr()] == bond::white) {
-          BreadthFirstSearchAdd_UnvisitedNode(Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem);
-        } else {
-          BreadthFirstSearchAdd_VisitedNode(Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem);
-        }
-      }
-    }
-    BFS.ColorList[Walker->getNr()] = bond::black;
-    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " black." << endl);
-  }
-  BreadthFirstSearchAdd_Free(BFS);
-}
-;
-
 /** Adds a bond as a copy to a given one
  * \param *left leftatom of new bond
