Index: molecuilder/src/molecules.cpp
===================================================================
--- molecuilder/src/molecules.cpp	(revision d88597aa69c6f959d77a250be93cb5904666ba09)
+++ molecuilder/src/molecules.cpp	(revision 461e93c3544e40161b6999a7d39ce445da6deff7)
@@ -2139,24 +2139,24 @@
  * \param &FragmentationToDo return boolean
  * \param Order desired Order
- */
-void molecule::CheckOrderAtSite(ofstream *out, bool &FragmentationToDo, int Order)
-{
-  atom *Walker = NULL; 
-  
-  if (FragmentationToDo) { // check whether OrderAtSite is above Order everywhere
-    FragmentationToDo = false;
-    Walker = start;
-    while (Walker->next != end) {
-      Walker = Walker->next;
+ * \return true - needs further fragmentation, false - does not need fragmentation
+ */
+bool molecule::CheckOrderAtSite(ofstream *out, int Order)
+{
+  atom *Walker = NULL;
+  bool status = false;
+  
+  Walker = start;
+  while (Walker->next != end) {
+    Walker = Walker->next;
 #ifdef ADDHYDROGEN
-      if (Walker->type->Z != 1) // skip hydrogen
+    if (Walker->type->Z != 1) // skip hydrogen
 #endif
-        if (Walker->AdaptiveOrder < Order)
-          FragmentationToDo = true;
-    }
-    if (!FragmentationToDo)
-      *out << Verbose(1) << "Order at every site is already equal or above desired order " << Order << "." << endl;
-  } else
-    *out << Verbose(1) << "Parsing order at site file failed" << endl;
+      if (Walker->AdaptiveOrder < Order)
+        status = true;
+  }
+  if (!status)
+    *out << Verbose(1) << "Order at every site is already equal or above desired order " << Order << "." << endl;
+ 
+  return status;
 };
 
@@ -2234,5 +2234,5 @@
 #endif
 
-  // ++++++++++++++++++++++++++++ INITIAL STUFF: Bond structure analysis, ... ++++++++++++++++++++++++++++++++++++++++++
+  // ++++++++++++++++++++++++++++ INITIAL STUFF: Bond structure analysis, file parsing, ... ++++++++++++++++++++++++++++++++++++++++++
   
   // ===== 1. Check whether bond structure is same as stored in files ====
@@ -2258,5 +2258,4 @@
   // ===== 4. check globally whether there's something to do actually (first adaptivity check)
   FragmentationToDo = FragmentationToDo && ParseOrderAtSiteFromFile(out, configuration->configpath);
-  CheckOrderAtSite(out, FragmentationToDo, Order);
   
   // =================================== Begin of FRAGMENTATION =============================== 
@@ -2265,31 +2264,33 @@
     *out << Verbose(0) << "Bond order " << Order << " greater than or equal to Minimum Ring size of " << MinimumRingSize << " found is not allowed." << endl;
   } else {
-    // ===== 6a. fill RootStack for each subgraph (second adaptivity check) ===== 
-    // NOTE: (keep this extern of following while loop, as lateron we may here look for which site to add to which subgraph)
-    // fill the root stack
+    // ===== 6a. assign each keyset to its respective subgraph ===== 
+    Subgraphs->next->AssignKeySetsToFragment(out, this, ParsedFragmentList, ListOfLocalAtoms, FragmentList, (FragmentCounter = 0), false);
+    delete(ParsedFragmentList);
+
     KeyStack *RootStack = new KeyStack[Subgraphs->next->Count()];
-    Subgraphs->next->FillRootStackForSubgraphs(out, RootStack, Order, (FragmentCounter = 0));
-
-   // ===== 6b. assign each keyset to its respective subgraph ===== 
-    Subgraphs->next->AssignKeySetsToFragment(out, this, ParsedFragmentList, ListOfLocalAtoms, FragmentList, (FragmentCounter = 0), false);
-
-   // ===== 7. fill the bond fragment list =====
-    FragmentCounter = 0;
-    MolecularWalker = Subgraphs;
-    while (MolecularWalker->next != NULL) {
-      MolecularWalker = MolecularWalker->next;
-      *out << Verbose(1) << "Fragmenting subgraph " << MolecularWalker << "." << endl;
-      // output ListOfBondsPerAtom for debugging
-      MolecularWalker->Leaf->OutputListOfBonds(out);
-      if (MolecularWalker->Leaf->first->next != MolecularWalker->Leaf->last) {
-      
-        // call BOSSANOVA method
-        *out << Verbose(0) << endl << " ========== BOND ENERGY of subgraph " << FragmentCounter << " ========================= " << endl;
-        MolecularWalker->Leaf->FragmentBOSSANOVA(out, FragmentList[FragmentCounter], RootStack[FragmentCounter]);
-      } else {
-        cerr << "Subgraph " << MolecularWalker << " has no atoms!" << endl;
-      }
-      FragmentCounter++;  // next fragment list
-    }
+    while (CheckOrderAtSite(out, Order)) {
+      // ===== 6b. fill RootStack for each subgraph (second adaptivity check) ===== 
+      Subgraphs->next->FillRootStackForSubgraphs(out, RootStack, Order, (FragmentCounter = 0));
+
+      // ===== 7. fill the bond fragment list =====
+      FragmentCounter = 0;
+      MolecularWalker = Subgraphs;
+      while (MolecularWalker->next != NULL) {
+        MolecularWalker = MolecularWalker->next;
+        *out << Verbose(1) << "Fragmenting subgraph " << MolecularWalker << "." << endl;
+        // output ListOfBondsPerAtom for debugging
+        MolecularWalker->Leaf->OutputListOfBonds(out);
+        if (MolecularWalker->Leaf->first->next != MolecularWalker->Leaf->last) {
+        
+          // call BOSSANOVA method
+          *out << Verbose(0) << endl << " ========== BOND ENERGY of subgraph " << FragmentCounter << " ========================= " << endl;
+          MolecularWalker->Leaf->FragmentBOSSANOVA(out, FragmentList[FragmentCounter], RootStack[FragmentCounter]);
+        } else {
+          cerr << "Subgraph " << MolecularWalker << " has no atoms!" << endl;
+        }
+        FragmentCounter++;  // next fragment list
+      }
+    }
+    delete[](RootStack);
   }
   
@@ -2305,5 +2306,4 @@
   
   // free subgraph memory again
-  delete(ParsedFragmentList);
   FragmentCounter = 0;
   if (Subgraphs != NULL) {
