Index: src/Fragmentation/PowerSetGenerator.cpp
===================================================================
--- src/Fragmentation/PowerSetGenerator.cpp	(revision 569e4266ba1a86102a1aa628754109f76b5f4ad9)
+++ src/Fragmentation/PowerSetGenerator.cpp	(revision a1d035b607ef83181b73011d15d49b99f191f507)
@@ -65,15 +65,15 @@
 /** Clears the touched list
  * \param verbosity verbosity level
- * \param *&TouchedList touched list
+ * \param &TouchedList touched list
  * \param SubOrder current suborder
  * \param TouchedIndex currently touched
  */
-void PowerSetGenerator::ClearingTouched(int verbosity, int *&TouchedList, int SubOrder, int &TouchedIndex)
+void PowerSetGenerator::ClearingTouched(int verbosity, TouchedList_t &TouchedList, int SubOrder, int &TouchedIndex)
 {
   LOG(1+verbosity, "Clearing touched list.");
+  TouchedList.resize(SubOrder+1, -1);
   for (TouchedIndex=SubOrder+1;TouchedIndex--;)  // empty touched list
     TouchedList[TouchedIndex] = -1;
   TouchedIndex = 0;
-
 }
 
@@ -84,9 +84,9 @@
  * \param *FragmentSet snake stack to remove from
  * \param &BondsSet set of bonds
- * \param *&TouchedList touched list
+ * \param &TouchedList touched list
  * \param TouchedIndex currently touched
  * \return number of set bits
  */
-int PowerSetGenerator::AddPowersetToSnakeStack(int verbosity, int CurrentCombination, int SetDimension, KeySet *FragmentSet, std::vector<bond::ptr > &BondsSet, int *&TouchedList, int &TouchedIndex)
+int PowerSetGenerator::AddPowersetToSnakeStack(int verbosity, int CurrentCombination, int SetDimension, KeySet *FragmentSet, std::vector<bond::ptr > &BondsSet, TouchedList_t &TouchedList, int &TouchedIndex)
 {
   atom *OtherWalker = NULL;
@@ -118,9 +118,9 @@
  * \param SetFirst begin iterator first bond
  * \param SetLast end iterator
- * \param *&TouchedList touched list
+ * \param &TouchedList touched list
  * \param TouchedIndex currently touched
  * \return number of elements
  */
-int PowerSetGenerator::CountSetMembers(std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, int *&TouchedList, int TouchedIndex)
+int PowerSetGenerator::CountSetMembers(std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, const TouchedList_t &TouchedList, int TouchedIndex)
 {
   int SetDimension = 0;
@@ -128,6 +128,7 @@
       Binder != SetLast;
       ++Binder) {
-    for (int k=TouchedIndex;k--;) {
-      if ((*Binder)->Contains(TouchedList[k]))   // if we added this very endpiece
+    for (TouchedList_t::const_iterator iter = TouchedList.begin();
+        iter != TouchedList.end(); ++iter) {
+      if ((*Binder)->Contains(*iter))   // if we added this very endpiece
         SetDimension++;
     }
@@ -140,9 +141,9 @@
  * \param SetFirst begin iterator first bond
  * \param SetLast end iterator
- * \param *&TouchedList touched list
+ * \param &TouchedList touched list
  * \param TouchedIndex currently touched
  * \return number of elements
  */
-int PowerSetGenerator::FillBondsList(std::vector<bond::ptr > &BondsList, std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, int *&TouchedList, int TouchedIndex)
+int PowerSetGenerator::FillBondsList(std::vector<bond::ptr > &BondsList, std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, const TouchedList_t &TouchedList, int TouchedIndex)
 {
   int SetDimension = 0;
@@ -150,6 +151,7 @@
       Binder != SetLast;
       ++Binder) {
-    for (int k=0;k<TouchedIndex;k++) {
-      if ((*Binder)->leftatom->getNr() == TouchedList[k])   // leftatom is always the closer one
+    for (TouchedList_t::const_iterator iter = TouchedList.begin();
+        iter != TouchedList.end(); ++iter) {
+      if ((*Binder)->leftatom->getNr() == *iter)   // leftatom is always the closer one
         BondsList[SetDimension++] = (*Binder);
     }
@@ -161,15 +163,15 @@
  * \param verbosity verbosity level
  * \param *FragmentSet snake stack to remove from
- * \param *&TouchedList touched list
- * \param TouchedIndex currently touched
- */
-void PowerSetGenerator::RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, int *&TouchedList, int &TouchedIndex)
-{
-  int Removal = 0;
-  for(int j=0;j<TouchedIndex;j++) {
-    Removal = TouchedList[j];
+ * \param &TouchedList touched list
+ * \param TouchedIndex currently touched
+ */
+void PowerSetGenerator::RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, TouchedList_t &TouchedList, int &TouchedIndex)
+{
+  for (TouchedList_t::iterator iter = TouchedList.begin();
+      iter != TouchedList.end();++iter) {
+    const int Removal = *iter;
     LOG(2+verbosity, "Removing item nr. " << Removal << " from snake stack.");
     FragmentSet->erase(Removal);
-    TouchedList[j] = -1;
+    (*iter) = -1;
   }
   std::stringstream output;
@@ -261,5 +263,5 @@
   int TouchedIndex, SubSetDimension, Added;
   int SpaceLeft;
-  int *TouchedList = new int[SubOrder + 1];
+  TouchedList_t TouchedList(SubOrder + 1, -1);
   KeySetTestPair TestKeySetInsert;
 
@@ -330,5 +332,4 @@
     }
   }
-  delete[](TouchedList);
   LOG(1+verbosity, "End of SPFragmentGenerator, " << RootDistance << " away from Root " << *FragmentSearch->getRoot() << " and SubOrder is " << SubOrder << ".");
 };
Index: src/Fragmentation/PowerSetGenerator.hpp
===================================================================
--- src/Fragmentation/PowerSetGenerator.hpp	(revision 569e4266ba1a86102a1aa628754109f76b5f4ad9)
+++ src/Fragmentation/PowerSetGenerator.hpp	(revision a1d035b607ef83181b73011d15d49b99f191f507)
@@ -29,11 +29,13 @@
   ~PowerSetGenerator();
 
+  typedef std::vector<int> TouchedList_t;
+
   void SPFragmentGenerator(int RootDistance, std::vector<bond::ptr > &BondsSet, int SetDimension, int SubOrder);
   int operator()(KeySet &RestrictedKeySet, const enum HydrogenTreatment treatment);
-  void RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, int *&TouchedList, int &TouchedIndex);
-  int FillBondsList(std::vector<bond::ptr > &BondsList, std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, int *&TouchedList, int TouchedIndex);
-  int CountSetMembers(std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, int *&TouchedList, int TouchedIndex);
-  int AddPowersetToSnakeStack(int verbosity, int CurrentCombination, int SetDimension, KeySet *FragmentSet, std::vector<bond::ptr > &BondsSet, int *&TouchedList, int &TouchedIndex);
-  void ClearingTouched(int verbosity, int *&TouchedList, int SubOrder, int &TouchedIndex);
+  void RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, TouchedList_t &TouchedList, int &TouchedIndex);
+  int FillBondsList(std::vector<bond::ptr > &BondsList, std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, const TouchedList_t &TouchedList, int TouchedIndex);
+  int CountSetMembers(std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, const TouchedList_t &TouchedList, int TouchedIndex);
+  int AddPowersetToSnakeStack(int verbosity, int CurrentCombination, int SetDimension, KeySet *FragmentSet, std::vector<bond::ptr > &BondsSet, TouchedList_t &TouchedList, int &TouchedIndex);
+  void ClearingTouched(int verbosity, TouchedList_t &TouchedList, int SubOrder, int &TouchedIndex);
 
 private:
