diff --git a/AMDiS/src/BasisFunction.cc b/AMDiS/src/BasisFunction.cc
index 92b1dcc4b9503b8a5705dafaa283f61fb7b96d4a..c5ee18d1399e5e9a07f9bd2b7b09cb390015f354 100644
--- a/AMDiS/src/BasisFunction.cc
+++ b/AMDiS/src/BasisFunction.cc
@@ -38,7 +38,7 @@ namespace AMDiS {
   {
     DELETE nDOF;
 
-    for (int i = 0; i < grdTmpVec1.size(); i++) {
+    for (int i = 0; i < static_cast<int>(grdTmpVec1.size()); i++) {
       DELETE grdTmpVec1[i];
       DELETE grdTmpVec2[i];
     }
diff --git a/AMDiS/src/BoundaryManager.cc b/AMDiS/src/BoundaryManager.cc
index a3324b366d3090b383beb230703965129df64c72..17955a1db169ba332531bc1d87f20005a9d9c40b 100644
--- a/AMDiS/src/BoundaryManager.cc
+++ b/AMDiS/src/BoundaryManager.cc
@@ -80,7 +80,6 @@ namespace AMDiS {
     if (localBCs.size() > 0) {
       // get boundaries of all DOFs
       const BoundaryType *localBound = basisFcts->getBound(elInfo, NULL);
-
       // get dof indices
       basisFcts->getLocalIndicesVec(elInfo->getElement(), admin, &dofIndices);
 
@@ -88,11 +87,11 @@ namespace AMDiS {
       for (it = localBCs.begin(); it != localBCs.end(); ++it) {
 	if ((*it).second) {
 	  if (!(*it).second->isDirichlet()) {
-	     (*it).second->fillBoundaryCondition(mat, elInfo, &dofIndices[0], localBound, nBasFcts);
+	    (*it).second->fillBoundaryCondition(mat, elInfo, &dofIndices[0], localBound, nBasFcts);
 	  }
 	}
       }
-      
+
       // apply dirichlet boundary conditions
       for (it = localBCs.begin(); it != localBCs.end(); ++it) {
 	if ((*it).second) {
diff --git a/AMDiS/src/MacroReader.cc b/AMDiS/src/MacroReader.cc
index 7157b259e7325030e106aa104be2788de6c87a48..a447efc6081c58619d1d330ba92c2ea2051e0f04 100644
--- a/AMDiS/src/MacroReader.cc
+++ b/AMDiS/src/MacroReader.cc
@@ -2050,58 +2050,59 @@ namespace AMDiS {
 
   int MacroReader::basicDOFCheckFct(ElInfo* elinfo)
   {
-    FUNCNAME("MacroReader::basicDOFCheckFct");
+    FUNCNAME("MacroReader::basicDOFCheckFct()");
     
     Mesh* mesh = Mesh::traversePtr;
     Element* el = elinfo->getElement();
-
-    const DOFAdmin&  adm = mesh->getDOFAdmin(mesh->iadmin);
-    const Element        *neig;
-    const DegreeOfFreedom       *dof;
-    int       i, j, jdof, ndof, i0, j0, ov;
+    const DOFAdmin& admin = mesh->getDOFAdmin(mesh->iadmin);
+    const Element *neig;
+    const DegreeOfFreedom *dof;
 
     if (0 == mesh->dof_used.size()) 
       return 0;
 
-    if ((ndof = adm.getNumberOfDOFs(VERTEX))) {
-	j0 = adm.getNumberOfPreDOFs(VERTEX);
-	TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(VERTEX))
-	  ("adm.getNumberOfPreDOFs(VERTEX) %d + nDOF %d > mesh->nDOF %d\n",
-	   j0, ndof, mesh->getNumberOfDOFs(VERTEX));
-	i0 = mesh->getNode(VERTEX);
-	for (i = 0; i < mesh->getGeo(VERTEX); i++)
-	  {
-	    if ((dof = el->getDOF(i0+i)) == NULL)
-	      ERROR("no vertex dof %d on element %d\n", i, el->getIndex());
-	    else
-	      for (j = 0; j < ndof; j++)
-		{
-		  jdof = dof[j0 + j];
-		  TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
-		    ("vertex dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
-		  mesh->dof_used[jdof]++;
-		}
+    int ndof = admin.getNumberOfDOFs(VERTEX);
+    if (ndof) {
+      int j0 = admin.getNumberOfPreDOFs(VERTEX);
+      TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(VERTEX))
+	("admin.getNumberOfPreDOFs(VERTEX) %d + nDOF %d > mesh->nDOF %d\n",
+	 j0, ndof, mesh->getNumberOfDOFs(VERTEX));
+      int i0 = mesh->getNode(VERTEX);
+      for (int i = 0; i < mesh->getGeo(VERTEX); i++) {
+	if ((dof = el->getDOF(i0+i)) == NULL) {
+	  ERROR("no vertex dof %d on element %d\n", i, el->getIndex());
+	} else {
+	  for (int j = 0; j < ndof; j++) {
+	    int jdof = dof[j0 + j];
+	    TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
+	      ("vertex dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
+	    mesh->dof_used[jdof]++;
 	  }
-	/* neighbour vertex dofs have been checked in check_fct() */
+	}
       }
+      /* neighbour vertex dofs have been checked in check_fct() */
+    }
 
   
     if (mesh->getDim() > 1) {
-      if ((ndof = adm.getNumberOfDOFs(EDGE))) {
-	j0 = adm.getNumberOfPreDOFs(EDGE);
+      ndof = admin.getNumberOfDOFs(EDGE);
+      if (ndof) {
+	int j0 = admin.getNumberOfPreDOFs(EDGE);
 
 	TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(EDGE))
-	  ("adm.getNumberOfPreDOFs(EDGE) %d + nDOF %d > mesh->nDOF %d\n",
+	  ("admin.getNumberOfPreDOFs(EDGE) %d + nDOF %d > mesh->nDOF %d\n",
 	   j0, ndof, mesh->getNumberOfDOFs(EDGE));
 
-	i0 = mesh->getNode(EDGE);
+	int i0 = mesh->getNode(EDGE);
 	
-	for (i = 0; i < mesh->getGeo(EDGE); i++) {
-	  if ((dof = el->getDOF(i0 + i)) == NULL) {
+	for (int i = 0; i < mesh->getGeo(EDGE); i++) {
+	  dof = el->getDOF(i0 + i);
+
+	  if (dof == NULL) {
 	    ERROR("no edge dof %d on element %d\n", i, el->getIndex());
 	  } else {
-	    for (j = 0; j < ndof; j++) {
-	      jdof = dof[j0 + j];
+	    for (int j = 0; j < ndof; j++) {
+	      int jdof = dof[j0 + j];
 	      TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
 		("edge dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
 	      mesh->dof_used[jdof]++;
@@ -2109,9 +2110,10 @@ namespace AMDiS {
 	  }
 
 	  if (el->getFirstChild() == NULL) {
-	    if(mesh->getDim() == 2) {
-	      if ((neig = elinfo->getNeighbour(i))) {
-		ov = elinfo->getOppVertex(i);
+	    if (mesh->getDim() == 2) {
+	      neig = elinfo->getNeighbour(i);
+	      if (neig) {
+		int ov = elinfo->getOppVertex(i);
 
 		TEST(neig->getDOF(i0 + ov) == dof)
 		  ("el %d edge %d dof %8X: wrong dof %8X in neighbour %d edge %d\n",
@@ -2119,15 +2121,14 @@ namespace AMDiS {
 		   neig->getIndex(), ov);
 	      }
 	    } else { // dim == 3
-	      int in, k, found;
-
-	      for (in = 0; in < mesh->getGeo(NEIGH); in++) {
+	      for (int in = 0; in < mesh->getGeo(NEIGH); in++) {
 		if ((in != el->getVertexOfEdge(i,0)) && 
 		    (in != el->getVertexOfEdge(i,1)) &&
 		    (neig = elinfo->getNeighbour(in))) {
-		  found = 0;
-		  for (k = 0; k < mesh->getGeo(EDGE); k++)
+		  int found = 0;
+		  for (int k = 0; k < mesh->getGeo(EDGE); k++) {
 		    if (neig->getDOF(i0 + k) == dof) found++;
+		  }
 		  TEST(found==1)("el %d edge %d dof found=%d in neighbour %d\n",
 				 el->getIndex(), i, found, neig->getIndex());
 		}
@@ -2138,17 +2139,18 @@ namespace AMDiS {
       }
     }
 
-    if(mesh->getDim()==3) {
-      if ((ndof = adm.getNumberOfDOFs(FACE))) {
-	j0 = adm.getNumberOfPreDOFs(FACE);
+    if (mesh->getDim() == 3) {
+      ndof = admin.getNumberOfDOFs(FACE);
+      if (ndof) {
+	int j0 = admin.getNumberOfPreDOFs(FACE);
 	TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(FACE))
 	  ("admin->n0_dof[FACE] %d + nDOF %d > mesh->nDOF %d\n",
 	   j0, ndof, mesh->getNumberOfDOFs(FACE));
-	i0 = mesh->getNode(FACE);
-	for (i = 0; i < mesh->getGeo(FACE); i++) {
+	int i0 = mesh->getNode(FACE);
+	for (int i = 0; i < mesh->getGeo(FACE); i++) {
 	  TEST(dof = el->getDOF(i0 + i))("no face dof %d ???\n", i);
-	  for (j = 0; j < ndof; j++) {
-	    jdof = dof[j0 + j];
+	  for (int j = 0; j < ndof; j++) {
+	    int jdof = dof[j0 + j];
 	    TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
 	      ("face dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
 	    mesh->dof_used[jdof]++;
@@ -2156,7 +2158,8 @@ namespace AMDiS {
 
 	  if (el->getChild(0) == NULL) {
 	    if ((neig = elinfo->getNeighbour(i))) {
-	      ov = elinfo->getOppVertex(i);
+	      int ov = elinfo->getOppVertex(i);
+
 	      TEST(neig->getDOF(i0 + ov) == dof)
 		("el %d face %d dof %8X: wrong dof %8X in neighbour %d face %d\n",
 		 el->getIndex(), i, dof, neig->getDOF(i0 + ov), neig->getIndex(),
@@ -2167,20 +2170,21 @@ namespace AMDiS {
       }
     }
 
-    if ((ndof = adm.getNumberOfDOFs(CENTER))) {
-	i0 = mesh->getNode(CENTER);
-	TEST(dof = el->getDOF(i0))("no center dof???\n");
-	j0 = adm.getNumberOfPreDOFs(CENTER);
-	TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(CENTER))
-	  ("adm.getNumberOfPreDOFs(CENTER) %d + nDOF %d > mesh->nDOF %d\n",
-	   j0, ndof, mesh->getNumberOfDOFs(CENTER));
-	for (j = 0; j < ndof; j++) {
-	    jdof = dof[j0 + j];
-	    TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
-	      ("center dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
-	    mesh->dof_used[jdof]++;
-	  }
+    ndof = admin.getNumberOfDOFs(CENTER);
+    if (ndof) {
+      int i0 = mesh->getNode(CENTER);
+      TEST(dof = el->getDOF(i0))("no center dof???\n");
+      int j0 = admin.getNumberOfPreDOFs(CENTER);
+      TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(CENTER))
+      ("admin.getNumberOfPreDOFs(CENTER) %d + nDOF %d > mesh->nDOF %d\n",
+       j0, ndof, mesh->getNumberOfDOFs(CENTER));
+      for (int j = 0; j < ndof; j++) {
+	int jdof = dof[j0 + j];
+	TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
+	  ("center dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
+	mesh->dof_used[jdof]++;
       }
+    }
 
     return 0;
   }
diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc
index 3c68e4d7f3cc844ac473a3cd9572a7dfff99736c..9d6054248c3899fe8fdab703120e697108754cf3 100644
--- a/AMDiS/src/Mesh.cc
+++ b/AMDiS/src/Mesh.cc
@@ -1069,21 +1069,21 @@ namespace AMDiS {
 
   bool Mesh::indirectlyAssociated(DegreeOfFreedom dof1, DegreeOfFreedom dof2) {
     ::std::vector<DegreeOfFreedom> associatedToDOF1;
-    int i, size;
     ::std::map<BoundaryType, VertexVector*>::iterator it;
     ::std::map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end();
     DegreeOfFreedom dof, assDOF;
 
     associatedToDOF1.push_back(dof1);
-    for(it = periodicAssociations.begin(); it != end; ++it) {
-      size = static_cast<int>(associatedToDOF1.size());
-      for(i = 0; i < size; i++) {
+    for (it = periodicAssociations.begin(); it != end; ++it) {
+      int size = static_cast<int>(associatedToDOF1.size());
+      for (int i = 0; i < size; i++) {
 	dof = associatedToDOF1[i];
 	assDOF = (*(it->second))[dof];
-	if(assDOF == dof2) {
+	if (assDOF == dof2) {
 	  return true;
 	} else {
-	  if(assDOF != dof) associatedToDOF1.push_back(assDOF);
+	  if (assDOF != dof) 
+	    associatedToDOF1.push_back(assDOF);
 	}
       }
     }
diff --git a/AMDiS/src/Mesh.h b/AMDiS/src/Mesh.h
index 74fca0653fdbc318aad99709c232a26161032abe..87bd74a0c967dd9df2bf32eba89a85c659791f27 100644
--- a/AMDiS/src/Mesh.h
+++ b/AMDiS/src/Mesh.h
@@ -617,18 +617,6 @@ namespace AMDiS {
      */
     inline bool isInitialized() { return initialized; };
   
-    //   inline void addPeriodicBC(BoundaryType type) {
-    //     periodicBoundaryTypes.insert(type);
-    //   };
-
-    //   inline bool isPeriodicBC(BoundaryType type) {
-    //     return (periodicBoundaryTypes.find(type) != periodicBoundaryTypes.end());
-    //   };
-
-    //   inline ::std::map<BoundaryType, PeriodicBC*>& getPeriodicBCMap() {
-    //     return periodicBoundaryConditions;
-    //   };
-
     inline ::std::map<BoundaryType, VertexVector*>& getPeriodicAssociations() {
       return periodicAssociations;
     };
@@ -817,11 +805,6 @@ namespace AMDiS {
      */
     bool preserveCoarseDOFs;
 
-    //   /** \brief
-    //    * List of all Meshes. Can be accessed via Mesh::begin() and Mesh::end()
-    //    */
-    //   static ::std::list<Mesh*> meshes;
-
     /** \brief
      * Number of all DOFs on a single element
      */
diff --git a/AMDiS/src/PeriodicBC.cc b/AMDiS/src/PeriodicBC.cc
index ed60cceab00b6fff8b74efc4bbab84e2ea5402b2..33b2f7536e8cc852fab26b543e21cd3f17754069 100644
--- a/AMDiS/src/PeriodicBC.cc
+++ b/AMDiS/src/PeriodicBC.cc
@@ -109,18 +109,14 @@ namespace AMDiS {
 
     if (!masterMatrix_) {
       masterMatrix_ = matrix;
-
       Mesh *mesh = matrix->getRowFESpace()->getMesh();
-
       associated_ = mesh->getPeriodicAssociations()[boundaryType];
       
-      TEST_EXIT_DBG(associated_)("no associations for periodic boundary condition %d\n",
-				 boundaryType);
-
-      const BasisFunction *basFcts = rowFESpace->getBasisFcts();
-      int num = basFcts->getNumber();
+      TEST_EXIT(associated_)
+	("no associations for periodic boundary condition %d\n", boundaryType);
 
-      neighIndices_ = GET_MEMORY(DegreeOfFreedom, num);
+      neighIndices_ = GET_MEMORY(DegreeOfFreedom, 
+				 rowFESpace->getBasisFcts()->getNumber());
     }
   }
 
@@ -131,30 +127,22 @@ namespace AMDiS {
 					 int                    nBasFcts)
   {
     if (matrix == masterMatrix_) {
-  
       int dim = rowFESpace->getMesh()->getDim();
+
       if (dim > 1) {
 	DOFAdmin *admin = rowFESpace->getAdmin();
-
 	FixVec<int, WORLD> elFace(dim, NO_INIT);
 	FixVec<int, WORLD> neighFace(dim, NO_INIT);
 	DimVec<int> vertexPermutation(dim, NO_INIT);
-
 	const BasisFunction *basFcts = rowFESpace->getBasisFcts();
 	int num = basFcts->getNumber();
-
 	Element *element = elInfo->getElement();
-
 	DimVec<DegreeOfFreedom> periodicDOFs(dim-1, NO_INIT);
-
 	int vertex, index, side;
-
 	GeoIndex sideGeoIndex = INDEX_OF_DIM(dim-1, dim);
 
 	for (side = 0; side < dim + 1; side++) {
-
 	  if (elInfo->getBoundary(sideGeoIndex, side) == boundaryType) {
-
 	    for (vertex = 0; vertex < dim; vertex++) {
 	      index = element->getVertexOfPosition(sideGeoIndex,
 						   side,
@@ -163,10 +151,9 @@ namespace AMDiS {
 	    }
 
 	    Element *neigh = elInfo->getNeighbour(side);
-
 	    basFcts->getLocalIndices(neigh, admin, neighIndices_);
-
 	    int oppVertex = 0;
+
 	    for (int i = 0; i < dim + 1; i++) {
 	      // get vertex permutation
 	      if (i == side) {
@@ -184,12 +171,13 @@ namespace AMDiS {
 	      }
 	      oppVertex += i - vertexPermutation[i];
 	    }
+
 	    vertexPermutation[side] = oppVertex;
 
 	    // get DOF permutation
 	    const DegreeOfFreedom *dofPermutation = 
 	      periodicDOFMapping_->getDOFPermutation(vertexPermutation);
-	
+
 	    // set associated dofs
 	    for (int i = 0; i < num; i++) {
 	      if ((*(basFcts->getCoords(i)))[side] == 0) {
diff --git a/AMDiS/src/ProblemScal.cc b/AMDiS/src/ProblemScal.cc
index 9ae4a1d19b5d355dd03547e3d5c29ac41c9eaa18..a0746ed8c46211b421cdbae8e8ae4226f8712c45 100644
--- a/AMDiS/src/ProblemScal.cc
+++ b/AMDiS/src/ProblemScal.cc
@@ -603,15 +603,15 @@ namespace AMDiS {
 					 Mesh::FILL_DET |
 					 Mesh::FILL_GRD_LAMBDA |
 					 Mesh::FILL_NEIGH);
+
     // for all elements ...
     while (elInfo) {
-      if (systemMatrix_->getBoundaryManager())
+      if (systemMatrix_->getBoundaryManager()) 
 	systemMatrix_->getBoundaryManager()->fillBoundaryConditions(elInfo, systemMatrix_);
       if (rhs_->getBoundaryManager())
 	rhs_->getBoundaryManager()->fillBoundaryConditions(elInfo, rhs_);
       if (solution_->getBoundaryManager())
 	solution_->getBoundaryManager()->fillBoundaryConditions(elInfo, solution_);
-
       elInfo = stack.traverseNext(elInfo);
     }
 
diff --git a/AMDiS/src/parareal/ProblemBase.h b/AMDiS/src/parareal/ProblemBase.h
index a47b2707c2a48f8fa172b7b7bb217c8ded04db01..0163199435efc4b687a31dfeb7b6a53924e4515e 100644
--- a/AMDiS/src/parareal/ProblemBase.h
+++ b/AMDiS/src/parareal/ProblemBase.h
@@ -42,6 +42,8 @@ namespace AMDiS {
       fineSolutions.clear();
       coarseSolutions.clear();
     }
+    
+    virtual ~ParaRealProblemBase() {};
 
     void storeSolution(T *vec)
     {