diff --git a/AMDiS/src/DOFAdmin.h b/AMDiS/src/DOFAdmin.h
index 6462be44c64781e3045284ff6685e5b994a3ac58..d3bc87f66664894952ed48d96d5d5e88961fce1d 100644
--- a/AMDiS/src/DOFAdmin.h
+++ b/AMDiS/src/DOFAdmin.h
@@ -82,7 +82,7 @@ namespace AMDiS {
     /** \brief
      * constructor
      */
-    DOFAdmin(Mesh* m,std::string aName);
+    DOFAdmin(Mesh* m, std::string aName);
 
     /** \brief
      * copy constructor
@@ -92,7 +92,7 @@ namespace AMDiS {
     /** \brief
      * destructor
      */
-    virtual ~DOFAdmin();
+    ~DOFAdmin();
 
     /** \brief
      * Enlarges the number of DOFs that can be managed at least to minsize by 
@@ -115,7 +115,7 @@ namespace AMDiS {
      */
     inline bool operator!=(const DOFAdmin& ad) const {
       return !(ad==*this);
-    };
+    }
   
     /** \brief
      * Adds a DOFIndexedBase object to the DOFAdmin. This object will be
diff --git a/AMDiS/src/DOFVector.hh b/AMDiS/src/DOFVector.hh
index 9abc9918404d199e7dbe306d8b922e3643651d0c..5a9201334a7106e3d40d7eb889a69709f2f845a0 100644
--- a/AMDiS/src/DOFVector.hh
+++ b/AMDiS/src/DOFVector.hh
@@ -82,6 +82,8 @@ namespace AMDiS {
     if (this->boundaryManager) {
       DELETE this->boundaryManager;
     }
+
+    vec.clear();
   }
 
   template<typename T>
diff --git a/AMDiS/src/Element.cc b/AMDiS/src/Element.cc
index a3eb22224dc84c8039bcb75ab6ea60a82bf0f998..047f2b40df1d155d7b5e308fcbe7a755397dfda2 100644
--- a/AMDiS/src/Element.cc
+++ b/AMDiS/src/Element.cc
@@ -53,17 +53,58 @@ namespace AMDiS {
 
   // call destructor through Mesh::freeElement !!!
   Element::~Element()
-  {
-    if (child[0]) 
+  {   
+    if (child[0]) {
       DELETE child[0];
-    if (child[1]) 
+    }
+    if (child[1]) {
       DELETE child[1];
+    }
 
     if (newCoord) {
       DELETE newCoord;
     }
   }
 
+  void Element::deleteElementDOFs()
+  {
+    int dim = mesh->getDim();
+    int j = 0;
+
+    for (int pos = 0; pos <= dim; pos++) {
+      GeoIndex position = INDEX_OF_DIM(pos, dim);
+      int ndof = 0;
+     
+      for (int i = 0; i < mesh->getNumberOfDOFAdmin(); i++) {
+	ndof += mesh->getDOFAdmin(i).getNumberOfDOFs(position);
+      }
+
+      if (ndof > 0) {
+	for (int i = 0; i < mesh->getGeo(position); i++) {
+	  if (dof[j] != NULL) {
+	    if (Mesh::serializedDOFs.count(dof[j][0]) == 0) {
+	      //	      std::cout << "FREE INNER: " << ndof << std::endl;
+	      FREE_MEMORY(dof[j], DegreeOfFreedom, ndof);
+	      Mesh::serializedDOFs[dof[j][0]] = NULL;
+	    }
+	  }
+	  
+	  j++;
+	}
+      }
+    }
+
+    //    std::cout << "FREE OUTER: " << mesh->getNumberOfNodes() << std::endl;
+    FREE_MEMORY(dof, DegreeOfFreedom*, mesh->getNumberOfNodes());
+
+    if (child[0]) {
+      child[0]->deleteElementDOFs();
+    }
+    if (child[1]) {
+      child[1]->deleteElementDOFs();
+    }
+  }
+
   Element* Element::cloneWithDOFs()
   {
     Element *el;
diff --git a/AMDiS/src/Element.h b/AMDiS/src/Element.h
index 91426b22a8611eb494ed57b607f4735136cbe70e..ab62a7b4483ae91fa53dc28c8ed392dcb7d833f7 100644
--- a/AMDiS/src/Element.h
+++ b/AMDiS/src/Element.h
@@ -84,7 +84,7 @@ namespace AMDiS {
     /** \brief
      * private standard constructor because an Element must know his Mesh
      */
-    Element() {};
+    Element() {}
   public:
     /** \brief
      * constructs an Element which belongs to Mesh
@@ -101,6 +101,8 @@ namespace AMDiS {
      */ 
     virtual ~Element();
 
+    void deleteElementDOFs();
+
     /** \brief
      * Clone this Element and return a reference to it. Because also the DOFs
      * are cloned, \ref Mesh::serializedDOfs must be used.
diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc
index 517c01c735dbec6419b90b70c2efdb5823b9724a..8d9e8c70067e0a4c3d6050efd8ff68d00d2b6acc 100644
--- a/AMDiS/src/Mesh.cc
+++ b/AMDiS/src/Mesh.cc
@@ -92,6 +92,7 @@ namespace AMDiS {
       elementDataPrototype(NULL),
       elementIndex(-1),
       initialized(false),
+      macroFileInfo(NULL),
       final_lambda(dimension, DEFAULT_VALUE, 0.0)
   {
 
@@ -118,7 +119,22 @@ namespace AMDiS {
   }
 
   Mesh::~Mesh()
-  {}
+  {
+    serializedDOFs.empty();
+
+    for (std::deque<MacroElement*>::const_iterator it = macroElements.begin();
+	 it != macroElements.end();
+	 ++it) {
+      (*it)->getElement()->deleteElementDOFs();
+      DELETE *it;
+    }    
+
+    serializedDOFs.empty();
+
+    if (macroFileInfo) {
+      DELETE macroFileInfo;
+    }
+  }
 
   Mesh& Mesh::operator=(const Mesh& m)
   {
@@ -540,10 +556,10 @@ namespace AMDiS {
 
   bool Mesh::findElInfoAtPoint(const WorldVector<double>& xy,
 			       ElInfo *el_info,
-			       DimVec<double>&    bary,
-			       const MacroElement      *start_mel,
+			       DimVec<double>& bary,
+			       const MacroElement *start_mel,
 			       const WorldVector<double> *xy0,
-			       double            *sp)
+			       double *sp)
   {
     static const MacroElement *mel = NULL;
     DimVec<double> lambda(dim, NO_INIT);
@@ -637,8 +653,9 @@ namespace AMDiS {
 	    MSG("outside finest level on el %d: s=%.3e\n", el->getIndex(), s);
 
 	  return(false);  /* ??? */
+	} else {
+	  return(false);
 	}
-	else return(false);
       }
     }
 
diff --git a/AMDiS/src/Serializable.h b/AMDiS/src/Serializable.h
index ef8250e93861d2004428f338f59be2c36917876a..1968c45aac7fc2ead529ed90951ec2fdf4afaa4f 100644
--- a/AMDiS/src/Serializable.h
+++ b/AMDiS/src/Serializable.h
@@ -52,9 +52,11 @@ namespace AMDiS {
     /** \brief
      * Returns the type name for this serializable object.
      */
-    virtual std::string getTypeName() const { return ""; };
+    virtual std::string getTypeName() const { 
+      return ""; 
+    }
 
-    virtual ~Serializable() {};
+    virtual ~Serializable() {}
   };
 
 }
diff --git a/AMDiS/src/SolutionDataStorage.h b/AMDiS/src/SolutionDataStorage.h
index 21fafca6f6009cd4694ed85e61d9669da72b9577..3fb25ee5ae5cf9c1253c1ae729600136ed51accb 100644
--- a/AMDiS/src/SolutionDataStorage.h
+++ b/AMDiS/src/SolutionDataStorage.h
@@ -66,10 +66,6 @@ namespace AMDiS {
 	     typename SolutionHelper<T>::type feSpace,
 	     double *timestep);
 
-    T* getSolution() {
-      return solutions[0];
-    }
-
     /** \brief
      * Deletes all pointers and empties all internal vectors.
      */
@@ -87,19 +83,20 @@ namespace AMDiS {
 
   protected:
     /** \brief
-     * Auxiliary function for deleting either a single fe space, or a
-     * vector of fe spaces.
+     * Deletes the fe space and all it content, i.e., also the dof admin, 
+     * mesh, etc.
      */
-    void deleteFeSpace(FiniteElemSpace* feSpace) {
-      DELETE feSpace;
-    }
+    void deleteFeSpace(FiniteElemSpace* feSpace);
 
+    /** \brief
+     * Deletes a list of fe spaces.
+     */
     void deleteFeSpace(std::vector<FiniteElemSpace*> feSpaces) {
       for (int i = 0; i < static_cast<int>(feSpaces.size()); i++) {
-	DELETE feSpaces[i];
+	deleteFeSpace(feSpaces[i]);
       }
 
-      feSpaces.empty();
+      feSpaces.clear();
     }
 
     int addMemoryUsage(FiniteElemSpace* feSpace) {
diff --git a/AMDiS/src/SolutionDataStorage.hh b/AMDiS/src/SolutionDataStorage.hh
index ec15a588de0643dd38b204a7143e1936676883c9..805b6de5a66a1d8c7a1c3de8333fbdc7ec75af1d 100644
--- a/AMDiS/src/SolutionDataStorage.hh
+++ b/AMDiS/src/SolutionDataStorage.hh
@@ -23,7 +23,6 @@ namespace AMDiS {
   template<typename T>
   SolutionDataStorage<T>::~SolutionDataStorage()
   {
-    clear();
   }
 
   template<typename T>
@@ -53,7 +52,7 @@ namespace AMDiS {
     timestamps.push_back(timestamp);
 
     lastPos++;
-    memoryUsage += solution->calcMemoryUsage();
+    //    memoryUsage += solution->calcMemoryUsage();
   }
 
   template<typename T>
@@ -112,25 +111,36 @@ namespace AMDiS {
   template<typename T>
   void SolutionDataStorage<T>::clear()
   {
-    for (int i = 0; i < static_cast<int>(solutions.size()); i++) {
-      DELETE solutions[i];    
+    for (int i = 1; i < static_cast<int>(solutions.size()); i++) {
+      DELETE solutions[i];
     }
 
-    std::cout << "MARK 1" << std::endl;
-
     if (!fixedFESpace) {
       for (int i = 0; i < static_cast<int>(feSpaces.size()); i++) {
 	deleteFeSpace(feSpaces[i]);    
       }
     }
 
-    std::cout << "MARK 2" << std::endl;
-
     solutions.clear();
     feSpaces.clear();
     timestamps.clear();
 
-    lastPos = -1;
+    lastPos = -1;    
+  }
+
+  template<typename T>
+  void SolutionDataStorage<T>::deleteFeSpace(FiniteElemSpace *feSpace) 
+  {
+    if (feSpace) {
+      if (feSpace->getMesh()) {
+	DELETE feSpace->getMesh();
+      }
+      if (feSpace->getAdmin()) {
+	DELETE feSpace->getAdmin();
+      }
+      
+      DELETE feSpace;
+    }
   }
-  
+
 }
diff --git a/AMDiS/src/SystemVector.h b/AMDiS/src/SystemVector.h
index b0286131996e753414d5cde51f8e556db7bab4ec..9f056c0fd3f75d87d1b02e4b01e9b38701eb7e3a 100644
--- a/AMDiS/src/SystemVector.h
+++ b/AMDiS/src/SystemVector.h
@@ -140,8 +140,12 @@ namespace AMDiS {
       }
     }
 
-    virtual ~SystemVector() 
-    {}
+    ~SystemVector() 
+    {
+      for (int i = 0; i < vectors.getSize(); i++) {
+	DELETE vectors[i];
+      }
+    }
 
     void createNewDOFVectors(std::string name)
     {