diff --git a/AMDiS/libtool b/AMDiS/libtool
index 5085abd47384de309fc7ed4c62546b5cf86917a0..730f91e3bbf372aaf166baad9d5d517ae0252bc6 100755
--- a/AMDiS/libtool
+++ b/AMDiS/libtool
@@ -85,7 +85,7 @@ NM="/usr/bin/nm -B"
 LN_S="ln -s"
 
 # What is the maximum length of a command?
-max_cmd_len=98304
+max_cmd_len=1572864
 
 # Object file suffix (normally "o").
 objext=o
@@ -128,7 +128,7 @@ old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
 old_postuninstall_cmds=""
 
 # A C compiler.
-LTCC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc"
+LTCC="/usr/lib64/mpi/gcc/openmpi//bin/mpicc"
 
 # LTCC compiler flags.
 LTCFLAGS="-g -O2"
@@ -233,10 +233,10 @@ finish_eval=""
 hardcode_into_libs=yes
 
 # Compile-time system search path for libraries.
-sys_lib_search_path_spec="/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /usr/lib64 /lib64 /fastfs/wir/local/lib /usr/x86_64-suse-linux/lib"
+sys_lib_search_path_spec="/usr/lib64/gcc/x86_64-suse-linux/4.5 /usr/lib64 /lib64 /usr/x86_64-suse-linux/lib"
 
 # Run-time system search path for libraries.
-sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/x86_64-suse-linux/lib /usr/local/lib64 /usr/local/lib /opt/kde3/lib64 /opt/kde3/lib /opt/gnome/lib64 /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /opt/cluster/intel/cce/9.1.042/lib /opt/cluster/intel/fce/9.1.036/lib /opt/cluster/Pathscale3.0/lib/2.9.99 /opt/cluster/Pathscale3.0/lib/2.9.99/32 /work/licsoft/compilers/pgi/linux86-64/6.2/lib /work/licsoft/compilers/pgi/linux86-64/6.2/libso "
+sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/lib64/Xaw3d /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/lib/Xaw3d /usr/x86_64-suse-linux/lib /usr/local/lib /opt/kde3/lib /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /opt/kde3/lib64 /usr/lib64/graphviz /usr/lib64/graphviz/sharp /usr/lib64/graphviz/java /usr/lib64/graphviz/perl /usr/lib64/graphviz/php /usr/lib64/graphviz/ocaml /usr/lib64/graphviz/python /usr/lib64/graphviz/lua /usr/lib64/graphviz/tcl /usr/lib64/graphviz/guile /usr/lib64/graphviz/ruby /usr/lib64/octave-3.2.4 "
 
 # Whether dlopen is supported.
 dlopen_support=unknown
@@ -259,7 +259,7 @@ LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64"
 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
 
 # A language specific compiler.
-CC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc"
+CC="/usr/lib64/mpi/gcc/openmpi//bin/mpicc"
 
 # Is the compiler the GNU compiler?
 with_gcc=yes
@@ -8914,7 +8914,7 @@ LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64"
 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
 
 # A language specific compiler.
-CC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicxx"
+CC="/usr/lib64/mpi/gcc/openmpi//bin/mpicxx"
 
 # Is the compiler the GNU compiler?
 with_gcc=yes
@@ -9039,17 +9039,17 @@ file_list_spec=""
 hardcode_action=immediate
 
 # The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs="/usr/lib64 /licsoft/libraries/openmpi/1.2.6/64bit/lib /usr/lib64/gcc/x86_64-suse-linux/4.1.2 /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /fastfs/wir/local/lib /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.."
+compiler_lib_search_dirs="/usr/lib64/mpi/gcc/openmpi/lib64 /usr/lib64/gcc/x86_64-suse-linux/4.5 /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/lib /usr/lib64/gcc/x86_64-suse-linux/4.5/../../.."
 
 # Dependencies to place before and after the objects being linked to
 # create a shared library.
-predep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbeginS.o"
-postdep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o"
+predep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.5/crtbeginS.o"
+postdep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.5/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crtn.o"
 predeps=""
-postdeps="-lmpi_cxx -lmpi -lopen-rte -lopen-pal -libverbs -lrt -lnuma -ldl -lnsl -lutil -ldl -lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s"
+postdeps="-lmpi_cxx -lmpi -lopen-rte -lopen-pal -ldl -lnsl -lutil -ldl -lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s"
 
 # The library search path used internally by the compiler when linking
 # a shared library.
-compiler_lib_search_path="-L/usr/lib64 -L/licsoft/libraries/openmpi/1.2.6/64bit/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/fastfs/wir/local/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.."
+compiler_lib_search_path="-L/usr/lib64/mpi/gcc/openmpi/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.5 -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../.."
 
 # ### END LIBTOOL TAG CONFIG: CXX
diff --git a/AMDiS/src/AMDiS.h b/AMDiS/src/AMDiS.h
index d534cfcfa1bd81bb4991ff1326c12f56c8dad82e..74da8b19f0ec4fc0643fae8ea37f4931c95fa0cb 100644
--- a/AMDiS/src/AMDiS.h
+++ b/AMDiS/src/AMDiS.h
@@ -1,7 +1,6 @@
 #ifndef AMDIS_H
 #define AMDIS_H
 
-#include "stdint.h"
 #include "AbstractFunction.h"
 #include "AdaptInfo.h"
 #include "AdaptInstationary.h"
diff --git a/AMDiS/src/ArhReader.cc b/AMDiS/src/ArhReader.cc
index f267644c3f4b08f5f53b468ba1ecfaa086c5fa87..f05fe9fb3f61965d765423f981d7d2d8569bac36 100644
--- a/AMDiS/src/ArhReader.cc
+++ b/AMDiS/src/ArhReader.cc
@@ -1,4 +1,5 @@
 #include <fstream>
+#include <stdint.h>
 
 #include "ArhReader.h"
 #include "Mesh.h"
@@ -107,13 +108,13 @@ namespace AMDiS {
       if (!macroElement) {
 	Element *mEl = elInfo->getMacroElement()->getElement();
 	for (int i = 0; i <= mesh->getDim(); i++)
-	  (*vec)[mEl->getDOF(i, 0)] = values[valuePos++];	
+	  (*vec)[mEl->getDof(i, 0)] = values[valuePos++];	
 	macroElement = true;
       }
 
       Element *el = elInfo->getElement();
       if (!el->isLeaf())
-	(*vec)[el->getChild(0)->getDOF(mesh->getDim(), 0)] = values[valuePos++];
+	(*vec)[el->getChild(0)->getDof(mesh->getDim(), 0)] = values[valuePos++];
 
       elInfo = stack.traverseNext(elInfo);
     }
diff --git a/AMDiS/src/ArhWriter.cc b/AMDiS/src/ArhWriter.cc
index 13b8b33d49d66c0545702f38da546fef0d0f7da7..8420771d7bed9b68499f39717e292cdf5b8897ce 100644
--- a/AMDiS/src/ArhWriter.cc
+++ b/AMDiS/src/ArhWriter.cc
@@ -1,4 +1,5 @@
 #include <fstream>
+#include <stdint.h>
 
 #include "ArhWriter.h"
 #include "Mesh.h"
@@ -73,7 +74,7 @@ namespace AMDiS {
 	  values[i].clear();
 
 	  for (int j = 0; j <= mesh->getDim(); j++)
-	    values[i].push_back((*vecs[i])[elInfo->getElement()->getDOF(j, 0)]);
+	    values[i].push_back((*vecs[i])[elInfo->getElement()->getDof(j, 0)]);
 	}
       }
 
@@ -81,7 +82,7 @@ namespace AMDiS {
       
       if (!elInfo->getElement()->isLeaf()) {
 	for (unsigned int i = 0; i < vecs.size(); i++)
-	  values[i].push_back((*vecs[i])[elInfo->getElement()->getChild(0)->getDOF(mesh->getDim(), 0)]);
+	  values[i].push_back((*vecs[i])[elInfo->getElement()->getChild(0)->getDof(mesh->getDim(), 0)]);
       }
 
       elInfo = stack.traverseNext(elInfo);
diff --git a/AMDiS/src/CoarseningManager1d.cc b/AMDiS/src/CoarseningManager1d.cc
index 9b19b9c5e2b0ce05057e9456c03861949e0456d2..f425cb684683d297971c6d088da03094e350e0dd 100644
--- a/AMDiS/src/CoarseningManager1d.cc
+++ b/AMDiS/src/CoarseningManager1d.cc
@@ -70,12 +70,12 @@ namespace AMDiS {
 
       if (mesh->getNumberOfDOFs(VERTEX) && !mesh->queryCoarseDOFs()) {
 	int node = mesh->getNode(VERTEX);
-	parent->setDOF(node+0, const_cast<int*>( child[0]->getDOF(node+0)));
-	parent->setDOF(node+1, const_cast<int*>( child[1]->getDOF(node+1)));
+	parent->setDof(node+0, const_cast<int*>( child[0]->getDof(node+0)));
+	parent->setDof(node+1, const_cast<int*>( child[1]->getDof(node+1)));
       }
 
       if (mesh->getNumberOfDOFs(CENTER) && !mesh->queryCoarseDOFs()) {
-	parent->setDOF(mesh->getNode(CENTER), mesh->getDof(CENTER));
+	parent->setDof(mesh->getNode(CENTER), mesh->getDof(CENTER));
       }
 
       /*--------------------------------------------------------------------------*/
@@ -102,13 +102,13 @@ namespace AMDiS {
 
       if (mesh->getNumberOfDOFs(VERTEX))    /*---  midpoint of parent          ---*/
 	{
-	  mesh->freeDof(const_cast<int*>( child[1]->getDOF(mesh->getNode(VERTEX))), VERTEX);
+	  mesh->freeDof(const_cast<int*>( child[1]->getDof(mesh->getNode(VERTEX))), VERTEX);
 	}
 
       if (mesh->getNumberOfDOFs(CENTER))    /*--- center of the children       ---*/
 	{
-	  mesh->freeDof(const_cast<int*>( child[0]->getDOF(mesh->getNode(CENTER))), CENTER);
-	  mesh->freeDof(const_cast<int*>( child[1]->getDOF(mesh->getNode(CENTER))), CENTER);
+	  mesh->freeDof(const_cast<int*>( child[0]->getDof(mesh->getNode(CENTER))), CENTER);
+	  mesh->freeDof(const_cast<int*>( child[1]->getDof(mesh->getNode(CENTER))), CENTER);
 	}
 
       parent->coarsenElementData(child[0], child[1]);
diff --git a/AMDiS/src/CoarseningManager2d.cc b/AMDiS/src/CoarseningManager2d.cc
index 24454798df6c91bbddfb63a438623cf9ac01f6d6..d29ea119bbbf3fa8c6e8d3aba0c28bd904108cd2 100644
--- a/AMDiS/src/CoarseningManager2d.cc
+++ b/AMDiS/src/CoarseningManager2d.cc
@@ -31,14 +31,14 @@ namespace AMDiS {
 
     // remove dof from common edge of child[0] and child[1]  
     if (mesh->getNumberOfDOFs(EDGE))
-      mesh->freeDof(const_cast<int*>(child[0]->getDOF(4)), EDGE);
+      mesh->freeDof(const_cast<int*>(child[0]->getDof(4)), EDGE);
 
     // remove dof from the barycenters of child[0] and child[1] 
     if (mesh->getNumberOfDOFs(CENTER)) {
       int node = mesh->getNode(CENTER);
       
-      mesh->freeDof(const_cast<int*>(child[0]->getDOF(node)), CENTER);
-      mesh->freeDof(const_cast<int*>(child[1]->getDOF(node)), CENTER);
+      mesh->freeDof(const_cast<int*>(child[0]->getDof(node)), CENTER);
+      mesh->freeDof(const_cast<int*>(child[1]->getDof(node)), CENTER);
     }
     
     el->coarsenElementData(child[0], child[1]);
@@ -71,10 +71,10 @@ namespace AMDiS {
       dynamic_cast<Triangle*>(const_cast<Element*>(coarsenList->getElement(1)));
     DegreeOfFreedom *dof[3];
 
-    dof[0] = const_cast<int*>(el->getChild(0)->getDOF(2));
+    dof[0] = const_cast<int*>(el->getChild(0)->getDof(2));
     if (mesh->getNumberOfDOFs(EDGE)) {
-      dof[1] = const_cast<int*>(el->getChild(0)->getDOF(3));
-      dof[2] = const_cast<int*>(el->getChild(1)->getDOF(4));
+      dof[1] = const_cast<int*>(el->getChild(0)->getDof(3));
+      dof[2] = const_cast<int*>(el->getChild(1)->getDof(4));
     } else {
       dof[1] = dof[2] = 0;
     }
@@ -83,10 +83,10 @@ namespace AMDiS {
       int node = mesh->getNode(EDGE);
       // get new dof on el at the midpoint of the coarsening edge
 
-      if (!el->getDOF(node + 2)) {
-	el->setDOF(node + 2, mesh->getDof(EDGE));
+      if (!el->getDof(node + 2)) {
+	el->setDof(node + 2, mesh->getDof(EDGE));
 	if (neigh)
-	  neigh->setDOF(node + 2, const_cast<int*>(el->getDOF(node + 2)));
+	  neigh->setDof(node + 2, const_cast<int*>(el->getDof(node + 2)));
       }
     }
 
@@ -149,12 +149,12 @@ namespace AMDiS {
 
     // give the refinement edge the right orientation
 
-    if (el->getDOF(0,0) < el->getDOF(1,0)) {
-      edge[0] = const_cast<int*>(el->getDOF(0));
-      edge[1] = const_cast<int*>(el->getDOF(1));
+    if (el->getDof(0,0) < el->getDof(1,0)) {
+      edge[0] = const_cast<int*>(el->getDof(0));
+      edge[1] = const_cast<int*>(el->getDof(1));
     } else {
-      edge[1] = const_cast<int*>(el->getDOF(0));
-      edge[0] = const_cast<int*>(el->getDOF(1));
+      edge[1] = const_cast<int*>(el->getDof(0));
+      edge[0] = const_cast<int*>(el->getDof(1));
     }
 
     coarse_list.setElement(0, el, true);
diff --git a/AMDiS/src/CoarseningManager3d.cc b/AMDiS/src/CoarseningManager3d.cc
index 8115f126cd139b9ef2a3b39714f9a84246b55194..33ea7db262d133446dfb5438f1c55e3694ce1035 100644
--- a/AMDiS/src/CoarseningManager3d.cc
+++ b/AMDiS/src/CoarseningManager3d.cc
@@ -47,12 +47,12 @@ namespace AMDiS {
     /*  give the refinement edge the right orientation                          */
     /****************************************************************************/
 
-    if (el->getDOF(0,0) < el->getDOF(1,0)) {
-      edge[0] = const_cast<int*>(el->getDOF(0));
-      edge[1] = const_cast<int*>(el->getDOF(1));
+    if (el->getDof(0,0) < el->getDof(1,0)) {
+      edge[0] = const_cast<int*>(el->getDof(0));
+      edge[1] = const_cast<int*>(el->getDof(1));
     } else {
-      edge[1] = const_cast<int*>(el->getDOF(0));
-      edge[0] = const_cast<int*>(el->getDOF(1));
+      edge[1] = const_cast<int*>(el->getDof(0));
+      edge[0] = const_cast<int*>(el->getDof(1));
     }
 
     coarsenList->setElement(0, el, true);
@@ -135,13 +135,13 @@ namespace AMDiS {
 
 	if (mesh->getNumberOfDOFs(EDGE)) {
 	  node = mesh->getNode(EDGE) + Tetrahedron::nChildEdge[el_type][0][dir];
-	  mesh->freeDof(const_cast<int*>( child[0]->getDOF(node)), EDGE);
+	  mesh->freeDof(const_cast<int*>( child[0]->getDof(node)), EDGE);
 	}
 	if (mesh->getNumberOfDOFs(FACE)) {
 	  node = mesh->getNode(FACE) + Tetrahedron::nChildFace[el_type][0][dir];
-	  mesh->freeDof(const_cast<int*>( child[0]->getDOF(node)), FACE);
+	  mesh->freeDof(const_cast<int*>( child[0]->getDof(node)), FACE);
 	  node = mesh->getNode(FACE) + Tetrahedron::nChildFace[el_type][1][dir];
-	  mesh->freeDof(const_cast<int*>( child[1]->getDOF(node)), FACE);
+	  mesh->freeDof(const_cast<int*>( child[1]->getDof(node)), FACE);
 	}
       }
     }
@@ -153,14 +153,14 @@ namespace AMDiS {
 
     if (mesh->getNumberOfDOFs(FACE)) {
       node = mesh->getNode(FACE);
-      mesh->freeDof(const_cast<int*>( child[0]->getDOF(node)), FACE);
+      mesh->freeDof(const_cast<int*>( child[0]->getDof(node)), FACE);
     }
 
 
     if (mesh->getNumberOfDOFs(CENTER)) {
       node = mesh->getNode(CENTER);
       for (i = 0; i < 2; i++)
-	mesh->freeDof(const_cast<int*>( child[i]->getDOF(node)), CENTER);
+	mesh->freeDof(const_cast<int*>( child[i]->getDof(node)), CENTER);
     }
 
     /****************************************************************************/
@@ -238,20 +238,20 @@ namespace AMDiS {
 			 
     while (neigh != el) {
       for (j = 0; j < n_vertices; j++)
-	if (neigh->getDOF(j) == edge[0])  break;
+	if (neigh->getDof(j) == edge[0])  break;
       for (k = 0; k < n_vertices; k++)
-	if (neigh->getDOF(k) == edge[1])  break;
+	if (neigh->getDof(k) == edge[1])  break;
 
       if (j > 3 || k > 3) {
 	for (j = 0; j < n_vertices; j++)
-	  if (mesh->associated(neigh->getDOF(j, 0), edge[0][0]))  break;
+	  if (mesh->associated(neigh->getDof(j, 0), edge[0][0]))  break;
 	for (k = 0; k < n_vertices; k++)
-	  if (mesh->associated(neigh->getDOF(k, 0), edge[1][0]))  break;
+	  if (mesh->associated(neigh->getDof(k, 0), edge[1][0]))  break;
      
 	TEST_EXIT_DBG(j < n_vertices  &&  k < n_vertices)
 	  ("dof %d or dof %d not found on element %d with nodes (%d %d %d %d)\n", 
-	   edge[0][0], edge[1][0], neigh->getIndex(), neigh->getDOF(0,0),
-	   neigh->getDOF(1,0), neigh->getDOF(2,0), neigh->getDOF(3,0));
+	   edge[0][0], edge[1][0], neigh->getIndex(), neigh->getDof(0,0),
+	   neigh->getDof(1,0), neigh->getDof(2,0), neigh->getDof(3,0));
       }
       edge_no = Tetrahedron::edgeOfDofs[j][k];
       coarsenList->setCoarsePatch(*n_neigh, edge_no == 0);
@@ -323,7 +323,7 @@ namespace AMDiS {
       /*  get dof for coarsening edge                                             */
       /****************************************************************************/
       node = mesh->getNode(EDGE);
-      if (!(dof = const_cast<int*>( el->getDOF(node))))
+      if (!(dof = const_cast<int*>( el->getDof(node))))
 	dof = mesh->getDof(EDGE);
     } else {
       dof = NULL;
@@ -356,13 +356,13 @@ namespace AMDiS {
     /*  remove dof's of the coarsening edge                                     */
     /****************************************************************************/
 
-    mesh->freeDof(const_cast<int*>( el->getChild(0)->getDOF(3)), VERTEX);
+    mesh->freeDof(const_cast<int*>( el->getChild(0)->getDof(3)), VERTEX);
     mesh->incrementNumberOfVertices(-1);
 
     if (mesh->getNumberOfDOFs(EDGE)) {
       node = mesh->getNode(EDGE) + 2;
-      mesh->freeDof(const_cast<int*>( el->getChild(0)->getDOF(node)), EDGE);
-      mesh->freeDof(const_cast<int*>( el->getChild(1)->getDOF(node)), EDGE);
+      mesh->freeDof(const_cast<int*>( el->getChild(0)->getDof(node)), EDGE);
+      mesh->freeDof(const_cast<int*>( el->getChild(1)->getDof(node)), EDGE);
     }
 
     if (coarsenList->getElement(0)->isNewCoordSet())
diff --git a/AMDiS/src/DOFAdmin.h b/AMDiS/src/DOFAdmin.h
index 1b99e91da1df3eb3336c1237d3f9ab0e566b2bc5..ca146fe2f61719ce7dfe96e908e69793b6ebb4b0 100644
--- a/AMDiS/src/DOFAdmin.h
+++ b/AMDiS/src/DOFAdmin.h
@@ -257,12 +257,12 @@ namespace AMDiS {
     void init();
 
     /** \brief
-     * Adds one index to all DOF lists. Used by Mesh::getDOF() to provide 
+     * Adds one index to all DOF lists. Used by Mesh::getDof() to provide 
      * DOFS for a specific position
      */
     int getDOFIndex();
 
-    /// Frees index dof. Used by Mesh::getDOF()
+    /// Frees index dof. Used by Mesh::getDof()
     void freeDofIndex(int dof);
 
     ///
diff --git a/AMDiS/src/DOFVector.cc b/AMDiS/src/DOFVector.cc
index edc2e1252fa2e7b914bc77e9d323fd5a8d74b4b4..415e93742b7fabb628ece04f1831d8af64a2d647 100644
--- a/AMDiS/src/DOFVector.cc
+++ b/AMDiS/src/DOFVector.cc
@@ -46,9 +46,9 @@ namespace AMDiS {
 
     Element *el = list.getElement(0);
     int n0 = feSpace->getAdmin()->getNumberOfPreDOFs(VERTEX);
-    DegreeOfFreedom dof0 = el->getDOF(0, n0);
-    DegreeOfFreedom dof1 = el->getDOF(1, n0);
-    DegreeOfFreedom dof_new = el->getChild(0)->getDOF(feSpace->getMesh()->getDim(), n0);
+    DegreeOfFreedom dof0 = el->getDof(0, n0);
+    DegreeOfFreedom dof1 = el->getDof(1, n0);
+    DegreeOfFreedom dof_new = el->getChild(0)->getDof(feSpace->getMesh()->getDim(), n0);
     vec[dof_new] = vec[dof0];
     vec[dof_new] += vec[dof1];
     vec[dof_new] *= 0.5;
@@ -114,7 +114,7 @@ namespace AMDiS {
     ElInfo *elInfo = stack.traverseFirst(mesh, -1, fillFlag);
 
     while (elInfo) {
-      const DegreeOfFreedom **dof = elInfo->getElement()->getDOF();
+      const DegreeOfFreedom **dof = elInfo->getElement()->getDof();
       const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda();
       getLocalVector(elInfo->getElement(), localUh);
 
@@ -186,7 +186,7 @@ namespace AMDiS {
 
     while (elInfo) {
       double det = elInfo->getDet();
-      const DegreeOfFreedom **dof = elInfo->getElement()->getDOF();
+      const DegreeOfFreedom **dof = elInfo->getElement()->getDof();
       const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda();
       getLocalVector(elInfo->getElement(), localUh);
       basFcts->evalGrdUh(bary, grdLambda, localUh, &grd);
@@ -674,7 +674,7 @@ namespace AMDiS {
     ElementVector localUh(basFcts->getNumber());
 
     while (elInfo) {
-      const DegreeOfFreedom **dof = elInfo->getElement()->getDOF();
+      const DegreeOfFreedom **dof = elInfo->getElement()->getDof();
       getLocalVector(elInfo->getElement(), localUh);
       const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda();
 
diff --git a/AMDiS/src/DataCollector.cc b/AMDiS/src/DataCollector.cc
index c4643feb8f4bd7708d5ecc6bda347815b735ab36..99d04294fc49a852515861de97cd80249afba77f 100644
--- a/AMDiS/src/DataCollector.cc
+++ b/AMDiS/src/DataCollector.cc
@@ -204,7 +204,7 @@ namespace AMDiS {
   {
     FUNCNAME("DataCollector::addElementData()");
 
-    const DegreeOfFreedom **dof = elInfo->getElement()->getDOF();
+    const DegreeOfFreedom **dof = elInfo->getElement()->getDof();
     DegreeOfFreedom vertexDOF;
     WorldVector<double> vertexCoords;
 
@@ -384,13 +384,13 @@ namespace AMDiS {
 	    int index1 = elInfo->getElement()->getVertexOfPosition(INDEX_OF_DIM(dim - 1, dim),
 								   it->elementSide,
 								   i);
-	    int dof1 = elInfo->getElement()->getDOF(index1, nPreDofs);
+	    int dof1 = elInfo->getElement()->getDof(index1, nPreDofs);
 	    
 	    for (int j = 0; j < dim; j++) {
 	      int index2 = elInfo->getElement()->getVertexOfPosition(INDEX_OF_DIM(dim - 1, dim),
 								     elInfo->getOppVertex(it->elementSide),
 								     j);
-	      int dof2 = elInfo->getNeighbour(it->elementSide)->getDOF(index2, nPreDofs);
+	      int dof2 = elInfo->getNeighbour(it->elementSide)->getDof(index2, nPreDofs);
 	      
 	      if ((dof1 == dof2) || (mesh->associated(dof1, dof2))) {
 		periodicInfo.vertexMap[index1] = index2;
diff --git a/AMDiS/src/Debug.cc b/AMDiS/src/Debug.cc
index 27b3a03ac391903b39e781c82f7938231943f117..ce62634053ff0c1f2367581c2343fc97c5f35ba4 100644
--- a/AMDiS/src/Debug.cc
+++ b/AMDiS/src/Debug.cc
@@ -265,7 +265,7 @@ namespace AMDiS {
       Mesh *mesh = feSpace->getMesh();
 
       for (int i = 0; i <= mesh->getDim(); i++) {
-	DegreeOfFreedom dof = el->getDOF(i, 0);
+	DegreeOfFreedom dof = el->getDof(i, 0);
 	WorldVector<double> coords;
 	mesh->getDofIndexCoords(dof, feSpace, coords);
 	MSG("%d-th DOF of element %d: %f %f %f\n", 
@@ -357,7 +357,7 @@ namespace AMDiS {
 	Element *el = elInfo->getElement();
 	for (int i = 0; i <= feSpace->getMesh()->getDim(); i++) {
 	  MSG("Coords for DOF %d = %f %f\n", 
-	      *(el->getDOF(i)), (elInfo->getCoord(i))[0], (elInfo->getCoord(i))[1]);
+	      *(el->getDof(i)), (elInfo->getCoord(i))[0], (elInfo->getCoord(i))[1]);
 	}
 	elInfo = stack.traverseNext(elInfo);
       }      
@@ -665,10 +665,10 @@ namespace AMDiS {
 	Element *el = elInfo->getElement();
 	switch (dim) {
 	case 2:
-	  sortDofs(el->getDOF(0), el->getDOF(1), el->getDOF(2), elMap[el->getIndex()]);
+	  sortDofs(el->getDof(0), el->getDof(1), el->getDof(2), elMap[el->getIndex()]);
 	  break;
 	case 3:
-	  sortDofs(el->getDOF(0), el->getDOF(1), el->getDOF(2), el->getDOF(3), elMap[el->getIndex()]);
+	  sortDofs(el->getDof(0), el->getDof(1), el->getDof(2), el->getDof(3), elMap[el->getIndex()]);
 	  break;
 	default:
 	  ERROR_EXIT("What is this?\n");
@@ -693,10 +693,10 @@ namespace AMDiS {
 	
 	switch (dim) {
 	case 2:
-	  sortDofs(el->getDOF(0), el->getDOF(1), el->getDOF(2), vec);
+	  sortDofs(el->getDof(0), el->getDof(1), el->getDof(2), vec);
 	  break;
 	case 3:
-	  sortDofs(el->getDOF(0), el->getDOF(1), el->getDOF(2), el->getDOF(3), vec);
+	  sortDofs(el->getDof(0), el->getDof(1), el->getDof(2), el->getDof(3), vec);
 	  break;
 	default:
 	  ERROR_EXIT("What is this?\n");
diff --git a/AMDiS/src/ElInfo.h b/AMDiS/src/ElInfo.h
index 0677385a52677912921063b374f2766f62b9237f..e536d155a3401c7dab644b837449e589f689c512 100644
--- a/AMDiS/src/ElInfo.h
+++ b/AMDiS/src/ElInfo.h
@@ -200,7 +200,7 @@ namespace AMDiS {
     }
 
     /// Get ElInfo's \ref oppVertex[i] 
-    inline unsigned char getOppVertex(int i) const 
+    inline int getOppVertex(int i) const 
     { 
       return oppVertex[i]; 
     }
@@ -524,7 +524,7 @@ namespace AMDiS {
      * Otherwise it is the local index of the neighbour's vertex opposite the
      * common edge/face.
      */
-    FixVec<unsigned char, NEIGH> oppVertex;
+    FixVec<int, NEIGH> oppVertex;
 
     /// Elements determinant.
     double det;
diff --git a/AMDiS/src/ElInfo2d.cc b/AMDiS/src/ElInfo2d.cc
index 5dbd2c16322ace8fa4e6bcae473c69d4e1fcd950..1b93c930b42400c6625d274a4f7c52d073381522 100644
--- a/AMDiS/src/ElInfo2d.cc
+++ b/AMDiS/src/ElInfo2d.cc
@@ -250,10 +250,10 @@ namespace AMDiS {
 		break;
 		
 	      case 2:
-		if (*(macroNeighbour->getElement()->getDOF(2)) == *(element->getDOF(0))) {
+		if (*(macroNeighbour->getElement()->getDof(2)) == *(element->getDof(0))) {
 		  neighbourCoord[i][0] = macroNeighbour->coord[2];
 		  neighbourCoord[i][1] = macroNeighbour->coord[1];
-		} else if (*(macroNeighbour->getElement()->getDOF(2)) == *(element->getDOF(1))) {
+		} else if (*(macroNeighbour->getElement()->getDof(2)) == *(element->getDof(1))) {
 		  neighbourCoord[i][0] = macroNeighbour->coord[0];
 		  neighbourCoord[i][1] = macroNeighbour->coord[2];		 
 		} else {
@@ -411,9 +411,17 @@ namespace AMDiS {
 	
 	Element *nb = elInfoOld->neighbour[2];
 	if (nb) {
-	  TEST(elInfoOld->oppVertex[2] == 2)("invalid neighbour\n"); 
-	  TEST_EXIT_DBG(nb->getFirstChild())("missing first child?\n");
-	  TEST_EXIT_DBG(nb->getSecondChild())("missing second child?\n");
+	  TEST_EXIT_DBG(elInfoOld->oppVertex[2] == 2)
+	    ("Fill child %d of element %d (mel %d): Invalid neighbour %d!\n",
+	     ichild,
+	     elInfoOld->getElement()->getIndex(), 
+	     elInfoOld->getMacroElement()->getIndex(),
+	     nb->getIndex());
+
+	  TEST_EXIT_DBG(nb->getFirstChild())
+	    ("Missing first child in element %d!\n", nb->getIndex());	  
+	  TEST_EXIT_DBG(nb->getSecondChild())
+	    ("Missing second child in element %d!\n", nb->getIndex());
 	 
 	  nb = nb->getSecondChild();
 
diff --git a/AMDiS/src/ElInfo3d.cc b/AMDiS/src/ElInfo3d.cc
index b67dd40ac8184b86d3db106bd1d57083c94a87a3..792ed4a146f767ecf6f0c5836e0e653545ce6598 100644
--- a/AMDiS/src/ElInfo3d.cc
+++ b/AMDiS/src/ElInfo3d.cc
@@ -414,12 +414,12 @@ namespace AMDiS {
 	    if (fill_opp_coords != Flag(0)) {
 	      int k = -1;
 	      for (int j = 0; j < vertices; j++)
-		if (element->getDOF(j) == nb->getDOF(1 - ov)) 
+		if (element->getDof(j) == nb->getDof(1 - ov)) 
 		  k = j;
 	      
 	      if (k == -1) {
 		for (int j = 0; j < vertices; j++)
-		  if (mesh->associated(element->getDOF(j, 0), nb->getDOF(1 - ov, 0)))
+		  if (mesh->associated(element->getDof(j, 0), nb->getDof(1 - ov, 0)))
 		    k = j;
 	      }
 	      TEST_EXIT_DBG(k >= 0)("neighbour dof not found\n");
@@ -585,11 +585,11 @@ namespace AMDiS {
 	  int k;
 	  for (k = 0; k < 2; k++) { /* look at both childs of old neighbour */
 	    nbk = const_cast<Element*>(nb->getChild(k));
-	    if (nbk->getDOF(0) == el_old->getDOF(ichild)) {
+	    if (nbk->getDof(0) == el_old->getDof(ichild)) {
 	      /* opp. vertex */
-	      dof = const_cast<int*>(nb->getDOF(elInfoOld->oppVertex[cv[i]])); 
+	      dof = const_cast<int*>(nb->getDof(elInfoOld->oppVertex[cv[i]])); 
 	      
-	      if (dof == nbk->getDOF(1)) {
+	      if (dof == nbk->getDof(1)) {
 		ov = 1;
 		if (nbk->getChild(0)) {
 		  if (fill_opp_coords.isAnySet()) {
@@ -606,7 +606,7 @@ namespace AMDiS {
 		  break;
 		}
 	      } else {
-		if (dof != nbk->getDOF(2)) { 
+		if (dof != nbk->getDof(2)) { 
 		  ov = -1; 
 		  break; 
 		}
@@ -628,13 +628,13 @@ namespace AMDiS {
 	  if (k == 2 || ov == -1) {
 	    for (k = 0; k < 2; k++) {  /* look at both childs of old neighbour */
 	      nbk = const_cast<Element*>(nb->getChild(k));
-	      if (nbk->getDOF(0) == el_old->getDOF(ichild) ||
-		  mesh->associated(nbk->getDOF(0, 0), el_old->getDOF(ichild, 0))) {
+	      if (nbk->getDof(0) == el_old->getDof(ichild) ||
+		  mesh->associated(nbk->getDof(0, 0), el_old->getDof(ichild, 0))) {
 		/* opp. vertex */
-		dof = const_cast<int*>(nb->getDOF(elInfoOld->oppVertex[cv[i]])); 
+		dof = const_cast<int*>(nb->getDof(elInfoOld->oppVertex[cv[i]])); 
 		
-		if (dof == nbk->getDOF(1) || 
-		    mesh->associated(dof[0], nbk->getDOF(1, 0))) {
+		if (dof == nbk->getDof(1) || 
+		    mesh->associated(dof[0], nbk->getDof(1, 0))) {
 		  ov = 1;
 		  if (nbk->getChild(0)) {
 		    if (fill_opp_coords.isAnySet()) {
@@ -651,8 +651,8 @@ namespace AMDiS {
 		    break;
 		  }
 		} else {
-		  TEST_EXIT_DBG(dof == nbk->getDOF(2) || 
-				mesh->associated(dof[0], nbk->getDOF(2, 0)))
+		  TEST_EXIT_DBG(dof == nbk->getDof(2) || 
+				mesh->associated(dof[0], nbk->getDof(2, 0)))
 		    ("opp_vertex not found\n");
 		  ov = 2;
 		}
diff --git a/AMDiS/src/Element.cc b/AMDiS/src/Element.cc
index ba79755b210f29ba981465c8fc1441801197e651..652479aaeb6586d688df6046158706742fdcb544 100644
--- a/AMDiS/src/Element.cc
+++ b/AMDiS/src/Element.cc
@@ -22,11 +22,10 @@ namespace AMDiS {
     elementData = NULL;
     mark = 0;
 
-    if (mesh) {
-      setDofPtrs();
-    } else {
-      mesh = NULL;
-    }
+    if (mesh)
+      createNewDofPtrs();
+    else
+      mesh = NULL;    
   }
 
 
@@ -64,7 +63,7 @@ namespace AMDiS {
   }
 
 
-  void Element::setDofPtrs()
+  void Element::createNewDofPtrs()
   {
     FUNCNAME("Element::setDofPtrs()");
 
diff --git a/AMDiS/src/Element.h b/AMDiS/src/Element.h
index e5d226afeb2cf32165d00994dfbd0779b015b925..8707c810e25b997f7dd796d0708d93e13a7c44ca 100644
--- a/AMDiS/src/Element.h
+++ b/AMDiS/src/Element.h
@@ -120,19 +120,19 @@ namespace AMDiS {
     }
 
     /// Returns \ref dof[i][j] which is the j-th DOF of the i-th node of Element.
-    const DegreeOfFreedom getDOF(int i, int j) const 
+    const DegreeOfFreedom getDof(int i, int j) const 
     { 
       return dof[i][j];
     }
 
     /// Returns \ref dof[i] which is a pointer to the DOFs of the i-th node.
-    const DegreeOfFreedom* getDOF(int i) const 
+    const DegreeOfFreedom* getDof(int i) const 
     {
       return dof[i];
     }
 
     /// Returns a pointer to the DOFs of this Element
-    const DegreeOfFreedom** getDOF() const 
+    const DegreeOfFreedom** getDof() const 
     {
       return const_cast<const DegreeOfFreedom**>(dof);
     }
@@ -271,10 +271,9 @@ namespace AMDiS {
     }
 
     /// Sets the pointer to the DOFs of the i-th node of Element
-    DegreeOfFreedom* setDOF(int pos, DegreeOfFreedom* p) 
+    inline void setDof(int pos, DegreeOfFreedom* p) 
     {
       dof[pos] = p;
-      return dof[pos];
     }
 
     /** \brief
@@ -511,10 +510,10 @@ namespace AMDiS {
     ///
     int calcMemoryUsage();
 
+    /// Sets Element's \ref dof pointer.
+    void createNewDofPtrs();
+ 
   protected:
-    /// Sets Element's \ref dof pointer. Used by friend class Mesh.
-    void setDofPtrs();
-  
     /// Sets Element's \ref index. Used by friend class Mesh.
     inline void setIndex(int i) 
     {
diff --git a/AMDiS/src/ElementDofIterator.cc b/AMDiS/src/ElementDofIterator.cc
index db470482af80b4dc2b65b995f5189070e2286980..005e46001d57b34504dd87d8eb67c92fa9eaf8c0 100644
--- a/AMDiS/src/ElementDofIterator.cc
+++ b/AMDiS/src/ElementDofIterator.cc
@@ -15,7 +15,7 @@ namespace AMDiS {
     TEST_EXIT_DBG(el)("No element!\n");
 
     element = el;
-    dofs = element->getDOF();
+    dofs = element->getDof();
 
     // Start with vertices.
     pos = 0;
diff --git a/AMDiS/src/ElementDofIterator.h b/AMDiS/src/ElementDofIterator.h
index 938a27a0c6cc761fc64b873de867b6ba54d7a9d7..f16d5b7174083eac80fd0cc1ea8c05eb25c91ef2 100644
--- a/AMDiS/src/ElementDofIterator.h
+++ b/AMDiS/src/ElementDofIterator.h
@@ -37,7 +37,7 @@ namespace AMDiS {
    *    ElementDofIterator elDofIter(feSpace);
    *    elDofIter.reset(el);
    *    do {
-   *       elDofIter.getDOF();
+   *       elDofIter.getDof();
    *    } while (elDofIter.next());
    *
    */
diff --git a/AMDiS/src/Lagrange.cc b/AMDiS/src/Lagrange.cc
index a57bed36140e7cdec5437963285001d27a74b31d..9e981ddbe062bd3e60296ff91686291ac6d35a96 100644
--- a/AMDiS/src/Lagrange.cc
+++ b/AMDiS/src/Lagrange.cc
@@ -716,7 +716,7 @@ namespace AMDiS {
       return &sortedEdgeDeg2;    
       
     int vertex[3];
-    int** dof = const_cast<int**>(el->getDOF());
+    int** dof = const_cast<int**>(el->getDof());
     int verticesOfPosition = dimOfPosition + 1;
 
     for (int i = 0; i < verticesOfPosition; i++)
@@ -911,7 +911,7 @@ namespace AMDiS {
     static DegreeOfFreedom *localVec = NULL;
     static int localVecSize = 0;
 
-    const DegreeOfFreedom **dof = el->getDOF();
+    const DegreeOfFreedom **dof = el->getDof();
 
     int nrDOFs, n0, node0, num = 0;
     GeoIndex posIndex;
@@ -962,7 +962,7 @@ namespace AMDiS {
     if (static_cast<int>(vec.size()) < nBasFcts)
       vec.resize(nBasFcts);
 
-    const DegreeOfFreedom **dof = el->getDOF();
+    const DegreeOfFreedom **dof = el->getDof();
     GeoIndex posIndex;
     int nrDOFs, n0, node0, num = 0;
 
@@ -1056,13 +1056,13 @@ namespace AMDiS {
     Element *el = list->getElement(0);
     int node = drv->getFeSpace()->getMesh()->getNode(CENTER);
     // Parent center
-    DegreeOfFreedom dof0 = el->getDOF(node, n0);           
+    DegreeOfFreedom dof0 = el->getDof(node, n0);           
     // Newest vertex is center 
-    DegreeOfFreedom dof_new = el->getChild(0)->getDOF(node, n0);  
+    DegreeOfFreedom dof_new = el->getChild(0)->getDof(node, n0);  
 
     (*drv)[dof_new] = (*drv)[dof0];
     // Newest vertex is center 
-    dof_new = el->getChild(1)->getDOF(node, n0);  
+    dof_new = el->getChild(1)->getDof(node, n0);  
     (*drv)[dof_new] = (*drv)[dof0];
   }
 
@@ -1078,11 +1078,11 @@ namespace AMDiS {
     int n0 = drv->getFeSpace()->getAdmin()->getNumberOfPreDOFs(VERTEX);
     Element *el = list->getElement(0);
     // 1st endpoint of refinement edge
-    DegreeOfFreedom dof0 = el->getDOF(0, n0);
+    DegreeOfFreedom dof0 = el->getDof(0, n0);
     // 2nd endpoint of refinement edge          
-    DegreeOfFreedom dof1 = el->getDOF(1, n0);
+    DegreeOfFreedom dof1 = el->getDof(1, n0);
     // newest vertex is DIM 
-    DegreeOfFreedom dof_new = el->getChild(0)->getDOF(dim, n0); 
+    DegreeOfFreedom dof_new = el->getChild(0)->getDof(dim, n0); 
     (*drv)[dof_new] = 0.5 * ((*drv)[dof0] + (*drv)[dof1]);
   }
 
@@ -1106,7 +1106,7 @@ namespace AMDiS {
     /****************************************************************************/
 
     // newest vertex is DIM
-    DegreeOfFreedom cdof = el->getChild(0)->getDOF(node + 1, n0);
+    DegreeOfFreedom cdof = el->getChild(0)->getDof(node + 1, n0);
     (*drv)[cdof] = (*drv)[pdof[2]];
 
     node = drv->getFeSpace()->getMesh()->getNode(CENTER);        
@@ -1116,7 +1116,7 @@ namespace AMDiS {
     /*  midpoint of edge on child[0] at the refinement edge                     */
     /****************************************************************************/
   
-    cdof = el->getChild(0)->getDOF(node, n0); 
+    cdof = el->getChild(0)->getDof(node, n0); 
     (*drv)[cdof] = 
       0.375 * (*drv)[pdof[0]] - 0.125 * (*drv)[pdof[1]] + 0.75 * (*drv)[pdof[2]];
 
@@ -1124,7 +1124,7 @@ namespace AMDiS {
     /*  midpoint of edge on child[1] at the refinement edge                     */
     /****************************************************************************/
   
-    cdof = el->getChild(1)->getDOF(node, n0); 
+    cdof = el->getChild(1)->getDof(node, n0); 
     (*drv)[cdof] = 
       -0.125 * (*drv)[pdof[0]] + 0.375 * (*drv)[pdof[1]] + 0.75 * (*drv)[pdof[2]];
   }
@@ -1149,7 +1149,7 @@ namespace AMDiS {
     /*  newest vertex of child[0] and child[1]                                  */
     /****************************************************************************/
 
-    DegreeOfFreedom cdof = el->getChild(0)->getDOF(node+2, n0);  /*      newest vertex is DIM */
+    DegreeOfFreedom cdof = el->getChild(0)->getDof(node+2, n0);  /*      newest vertex is DIM */
     (*drv)[cdof] = (*drv)[pdof[5]];
 
     node = drv->getFeSpace()->getMesh()->getNode(EDGE);        
@@ -1159,7 +1159,7 @@ namespace AMDiS {
     /*  midpoint of edge on child[0] at the refinement edge                     */
     /****************************************************************************/
   
-    cdof = el->getChild(0)->getDOF(node, n0); 
+    cdof = el->getChild(0)->getDof(node, n0); 
     (*drv)[cdof] = 
       0.375 * (*drv)[pdof[0]] - 0.125 * (*drv)[pdof[1]] + 0.75 * (*drv)[pdof[5]];
 
@@ -1167,7 +1167,7 @@ namespace AMDiS {
     /* node in the common edge of child[0] and child[1]                         */
     /****************************************************************************/
 
-    cdof = el->getChild(0)->getDOF(node+1, n0); 
+    cdof = el->getChild(0)->getDof(node+1, n0); 
     (*drv)[cdof] =
       -0.125 * ((*drv)[pdof[0]] + (*drv)[pdof[1]]) + 0.25 * (*drv)[pdof[5]]
       + 0.5 * ((*drv)[pdof[3]] + (*drv)[pdof[4]]);
@@ -1176,7 +1176,7 @@ namespace AMDiS {
     /*  midpoint of edge on child[1] at the refinement edge                     */
     /****************************************************************************/
   
-    cdof = el->getChild(1)->getDOF(node+1, n0); 
+    cdof = el->getChild(1)->getDof(node+1, n0); 
     (*drv)[cdof] = 
       -0.125 * (*drv)[pdof[0]] + 0.375 * (*drv)[pdof[1]]  + 0.75 * (*drv)[pdof[5]];
 
@@ -1187,7 +1187,7 @@ namespace AMDiS {
       el = list->getElement(1);
       pdof = basFct->getLocalIndices(el, admin, NULL);
       
-      cdof = el->getChild(0)->getDOF(node+1, n0); 
+      cdof = el->getChild(0)->getDof(node+1, n0); 
       (*drv)[cdof] = 
 	-0.125 * ((*drv)[pdof[0]] + (*drv)[pdof[1]]) + 0.25 * (*drv)[pdof[5]]
 	+ 0.5 * ((*drv)[pdof[3]] + (*drv)[pdof[4]]);
@@ -1233,7 +1233,7 @@ namespace AMDiS {
     /*  values on child[1]                                                      */
     /****************************************************************************/
   
-    DegreeOfFreedom cdofi = el->getChild(1)->getDOF(node0 + 2, n0);
+    DegreeOfFreedom cdofi = el->getChild(1)->getDof(node0 + 2, n0);
     (*drv)[cdofi] = 
       (-0.125 * (*drv)[pdof[0]] + 0.375 * (*drv)[pdof[1]] 
        + 0.75 * (*drv)[pdof[4]]);
@@ -1261,13 +1261,13 @@ namespace AMDiS {
       
       switch (lr_set) {
       case 1:
-	cdofi = el->getChild(0)->getDOF(node0+4, n0);      
+	cdofi = el->getChild(0)->getDof(node0+4, n0);      
 	(*drv)[cdofi] = 
 	  (0.125 * (-(*drv)[pdof[0]] - (*drv)[pdof[1]]) + 0.25 * (*drv)[pdof[4]]
 	   + 0.5 * ((*drv)[pdof[5]] + (*drv)[pdof[7]]));
 	break;
       case 2:
-	cdofi = el->getChild(0)->getDOF(node0+5, n0);      
+	cdofi = el->getChild(0)->getDof(node0+5, n0);      
 	(*drv)[cdofi] = 
 	  (0.125 * (-(*drv)[pdof[0]] - (*drv)[pdof[1]]) + 0.25 * (*drv)[pdof[4]]
 	   + 0.5 * ((*drv)[pdof[6]] + (*drv)[pdof[8]]));
@@ -1361,7 +1361,7 @@ namespace AMDiS {
 
     int node = drv->getFeSpace()->getMesh()->getNode(CENTER);  
     int n0 = admin->getNumberOfPreDOFs(CENTER);
-    int dof9 = el->getChild(1)->getDOF(node, n0);
+    int dof9 = el->getChild(1)->getDof(node, n0);
 
     (*drv)[dof9] =  
       (0.0625 * ((*drv)[pdof[0]] - (*drv)[pdof[1]]) +  0.375 * (*drv)[pdof[3]]
@@ -1456,7 +1456,7 @@ namespace AMDiS {
 
     int node = drv->getFeSpace()->getMesh()->getNode(CENTER);  
     int n0 = admin->getNumberOfPreDOFs(CENTER);
-    int dof9 = el->getChild(1)->getDOF(node, n0);
+    int dof9 = el->getChild(1)->getDof(node, n0);
 
     (*drv)[dof9] =  
       (0.0625 * ((*drv)[pdof[0]] - (*drv)[pdof[1]]) +  0.375 * (*drv)[pdof[3]]
@@ -1643,7 +1643,7 @@ namespace AMDiS {
       if (typ == 0) {
 	switch (lr_set) {
 	case 1:
-	  cdi = el->getChild(1)->getDOF(node0+1, n0);      
+	  cdi = el->getChild(1)->getDof(node0+1, n0);      
 	  TEST_EXIT_DBG(cdi == cd[17])("cdi != cd[17]\n");
 	  (*drv)[cdi] = 
 	    (0.0625*((*drv)[pd[0]] - (*drv)[pd[1]])
@@ -1651,7 +1651,7 @@ namespace AMDiS {
 	     + 0.375*(*drv)[pd[10]] + 0.75*(*drv)[pd[19]]);
 	  break;
 	case 2:
-	  cdi = el->getChild(1)->getDOF(node0+2, n0);      
+	  cdi = el->getChild(1)->getDof(node0+2, n0);      
 	  TEST_EXIT_DBG(cdi == cd[18])("cdi != cd[18]\n");
 	  (*drv)[cdi] = 
 	    (0.0625*((*drv)[pd[0]] - (*drv)[pd[1]])
@@ -1662,7 +1662,7 @@ namespace AMDiS {
       } else {
 	switch (lr_set) {
 	case 1:
-	  cdi = el->getChild(1)->getDOF(node0+2, n0);      
+	  cdi = el->getChild(1)->getDof(node0+2, n0);      
 	  TEST_EXIT_DBG(cdi == cd[18])("cdi != cd[18]\n");
 	  (*drv)[cdi] = 
 	    (0.0625*((*drv)[pd[0]] - (*drv)[pd[1]])
@@ -1670,7 +1670,7 @@ namespace AMDiS {
 	     + 0.375*(*drv)[pd[10]] + 0.75*(*drv)[pd[19]]);
 	  break;
 	case 2:
-	  cdi = el->getChild(1)->getDOF(node0+1, n0);      
+	  cdi = el->getChild(1)->getDof(node0+1, n0);      
 	  TEST_EXIT_DBG(cdi == cd[17])("cdi != cd[17]\n");
 	  (*drv)[cdi] = 
 	    (0.0625*((*drv)[pd[0]] - (*drv)[pd[1]])
@@ -2551,9 +2551,9 @@ namespace AMDiS {
 
     int n0 = drv->getFeSpace()->getAdmin()->getNumberOfPreDOFs(CENTER);
     Element* el = list->getElement(0);
-    int dof0 = el->getDOF(0,n0);           /* 1st endpoint of refinement edge */
-    int dof1 = el->getDOF(1,n0);           /* 2nd endpoint of refinement edge */
-    int dof_new = el->getChild(0)->getDOF(basFct->getDim(), n0);  
+    int dof0 = el->getDof(0,n0);           /* 1st endpoint of refinement edge */
+    int dof1 = el->getDof(1,n0);           /* 2nd endpoint of refinement edge */
+    int dof_new = el->getChild(0)->getDof(basFct->getDim(), n0);  
     /*  newest vertex is DIM */
     (*drv)[dof0] += 0.5*(*drv)[dof_new];
     (*drv)[dof1] += 0.5*(*drv)[dof_new];  
@@ -2572,10 +2572,10 @@ namespace AMDiS {
     Element *el = list->getElement(0);
 
     // 1st endpoint of refinement edge
-    DegreeOfFreedom dof0 = el->getDOF(0, n0);
+    DegreeOfFreedom dof0 = el->getDof(0, n0);
     // 2nd endpoint of refinement edge
-    DegreeOfFreedom dof1 = el->getDOF(1, n0);           
-    DegreeOfFreedom dof_new = el->getChild(0)->getDOF(basFct->getDim(), n0);  
+    DegreeOfFreedom dof1 = el->getDof(1, n0);           
+    DegreeOfFreedom dof_new = el->getChild(0)->getDof(basFct->getDim(), n0);  
     // newest vertex is DIM 
     (*drv)[dof0] += 0.5 * (*drv)[dof_new];
     (*drv)[dof1] += 0.5 * (*drv)[dof_new];  
@@ -2602,12 +2602,12 @@ namespace AMDiS {
 
     int node = drv->getFeSpace()->getMesh()->getNode(VERTEX);        
     int n0 = admin->getNumberOfPreDOFs(VERTEX);
-    DegreeOfFreedom cdof2 = el->getChild(0)->getDOF(node+2, n0);
+    DegreeOfFreedom cdof2 = el->getChild(0)->getDof(node+2, n0);
 
     node = drv->getFeSpace()->getMesh()->getNode(EDGE);        
     n0 = admin->getNumberOfPreDOFs(EDGE);
-    DegreeOfFreedom cdof3 = el->getChild(0)->getDOF(node, n0);
-    DegreeOfFreedom cdof4 = el->getChild(0)->getDOF(node+1, n0);
+    DegreeOfFreedom cdof3 = el->getChild(0)->getDof(node, n0);
+    DegreeOfFreedom cdof4 = el->getChild(0)->getDof(node+1, n0);
 
     (*drv)[pdof[0]] += 0.375*(*drv)[cdof3] - 0.125*(*drv)[cdof4];
     (*drv)[pdof[1]] += -0.125*((*drv)[cdof3] + (*drv)[cdof4]);
@@ -2619,7 +2619,7 @@ namespace AMDiS {
     /*  contributions of dofs located on child[1] and not on child[0]           */
     /****************************************************************************/
 
-    cdof4 = el->getChild(1)->getDOF(node+1, n0);
+    cdof4 = el->getChild(1)->getDof(node+1, n0);
 
     (*drv)[pdof[0]] += -0.125*(*drv)[cdof4];
     (*drv)[pdof[1]] += 0.375*(*drv)[cdof4];
@@ -2633,7 +2633,7 @@ namespace AMDiS {
       /*  first set those values not effected by previous element                 */
       /****************************************************************************/
       
-      cdof4 = el->getChild(0)->getDOF(node+1, n0);
+      cdof4 = el->getChild(0)->getDof(node+1, n0);
       (*drv)[pdof[3]] += 0.5*(*drv)[cdof4];
       (*drv)[pdof[4]] += 0.5*(*drv)[cdof4];
       
@@ -2702,7 +2702,7 @@ namespace AMDiS {
     /****************************************************************************/
 
     cdof = basFct->getLocalIndices(el->getChild(1), admin, NULL);
-    cdofi = el->getChild(1)->getDOF(node0+2, n0);
+    cdofi = el->getChild(1)->getDof(node0+2, n0);
 
     (*drv)[pdof[0]] += (-0.125*(*drv)[cdofi]);
     (*drv)[pdof[1]] += (0.375*(*drv)[cdofi]);
@@ -2733,7 +2733,7 @@ namespace AMDiS {
 
       switch (lr_set) {
       case 1:
-	cdofi = el->getChild(0)->getDOF(node0+4, n0);      
+	cdofi = el->getChild(0)->getDof(node0+4, n0);      
 	(*drv)[pdof[0]] += (-0.125*(*drv)[cdofi]);
 	(*drv)[pdof[1]] += (-0.125*(*drv)[cdofi]);
 	(*drv)[pdof[4]] += (0.25*(*drv)[cdofi]);
@@ -2741,7 +2741,7 @@ namespace AMDiS {
 	(*drv)[pdof[7]] += (0.5*(*drv)[cdofi]);
 	break;
       case 2:
-	cdofi = el->getChild(0)->getDOF(node0+5, n0);      
+	cdofi = el->getChild(0)->getDof(node0+5, n0);      
 	(*drv)[pdof[0]] += (-0.125*(*drv)[cdofi]);
 	(*drv)[pdof[1]] += (-0.125*(*drv)[cdofi]);
 	(*drv)[pdof[4]] += (0.25*(*drv)[cdofi]);
@@ -2846,7 +2846,7 @@ namespace AMDiS {
 
     node = drv->getFeSpace()->getMesh()->getNode(CENTER);  
     n0 = admin->getNumberOfPreDOFs(CENTER);
-    dof9 = el->getChild(1)->getDOF(node, n0);
+    dof9 = el->getChild(1)->getDof(node, n0);
 
     (*drv)[pdof[0]] += 0.0625*(*drv)[dof9];
     (*drv)[pdof[1]] -= 0.0625*(*drv)[dof9];
@@ -2948,7 +2948,7 @@ namespace AMDiS {
 
     node = drv->getFeSpace()->getMesh()->getNode(CENTER);  
     n0 = admin->getNumberOfPreDOFs(CENTER);
-    dof9 = el->getChild(1)->getDOF(node, n0);
+    dof9 = el->getChild(1)->getDof(node, n0);
 
     (*drv)[pdof[0]] += 0.0625*(*drv)[dof9];
     (*drv)[pdof[1]] -= 0.0625*(*drv)[dof9];
@@ -3162,7 +3162,7 @@ namespace AMDiS {
       if (typ == 0) {
 	switch (lr_set) {
 	case 1:
-	  cdi = el->getChild(1)->getDOF(node0+1, n0);      
+	  cdi = el->getChild(1)->getDof(node0+1, n0);      
 	  TEST_EXIT_DBG(cdi == cd[17])("cdi != cd[17]\n");
 	  (*drv)[pd[0]] += 0.0625*(*drv)[cdi];
 	  (*drv)[pd[1]] += -0.0625*(*drv)[cdi];
@@ -3173,7 +3173,7 @@ namespace AMDiS {
 	  (*drv)[pd[19]] += 0.75*(*drv)[cdi];
 	  break;
 	case 2:
-	  cdi = el->getChild(1)->getDOF(node0+2, n0);      
+	  cdi = el->getChild(1)->getDof(node0+2, n0);      
 	  TEST_EXIT_DBG(cdi == cd[18])("cdi != cd[18]\n");
 	  (*drv)[pd[0]] += 0.0625*(*drv)[cdi];
 	  (*drv)[pd[1]] += -0.0625*(*drv)[cdi];
@@ -3187,7 +3187,7 @@ namespace AMDiS {
       } else {
 	switch (lr_set) {
 	case 1:
-	  cdi = el->getChild(1)->getDOF(node0+2, n0);      
+	  cdi = el->getChild(1)->getDof(node0+2, n0);      
 	  TEST_EXIT_DBG(cdi == cd[18])("cdi != cd[18]\n");
 	  (*drv)[pd[0]] += 0.0625*(*drv)[cdi];
 	  (*drv)[pd[1]] += -0.0625*(*drv)[cdi];
@@ -3198,7 +3198,7 @@ namespace AMDiS {
 	  (*drv)[pd[19]] += 0.75*(*drv)[cdi];
 	  break;
 	case 2:
-	  cdi = el->getChild(1)->getDOF(node0+1, n0);      
+	  cdi = el->getChild(1)->getDof(node0+1, n0);      
 	  TEST_EXIT_DBG(cdi == cd[17])("cdi != cd[17]\n");
 	  (*drv)[pd[0]] += 0.0625*(*drv)[cdi];
 	  (*drv)[pd[1]] += -0.0625*(*drv)[cdi];
@@ -4235,9 +4235,9 @@ namespace AMDiS {
     const Mesh *mesh = drv->getFeSpace()->getMesh();
 
     // values on child[0] 
-    DegreeOfFreedom cdof = el->getChild(0)->getDOF(mesh->getNode(CENTER)+2, 
+    DegreeOfFreedom cdof = el->getChild(0)->getDof(mesh->getNode(CENTER)+2, 
 						   admin->getNumberOfPreDOFs(CENTER)); 
-    DegreeOfFreedom pdof = el->getDOF(mesh->getNode(CENTER)+2, admin->getNumberOfPreDOFs(CENTER)); 
+    DegreeOfFreedom pdof = el->getDof(mesh->getNode(CENTER)+2, admin->getNumberOfPreDOFs(CENTER)); 
     (*drv)[pdof] = (*drv)[cdof];
   }
 
@@ -4259,9 +4259,9 @@ namespace AMDiS {
     Mesh *mesh = const_cast<Mesh*>(drv->getFeSpace()->getMesh());
 
     // values on child[0] 
-    DegreeOfFreedom cdof = el->getChild(0)->getDOF(mesh->getNode(VERTEX) + 1, 
+    DegreeOfFreedom cdof = el->getChild(0)->getDof(mesh->getNode(VERTEX) + 1, 
 						   admin->getNumberOfPreDOFs(VERTEX)); 
-    DegreeOfFreedom pdof = el->getDOF(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER)); 
+    DegreeOfFreedom pdof = el->getDof(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER)); 
     (*drv)[pdof] = (*drv)[cdof];
   }
 
@@ -4282,9 +4282,9 @@ namespace AMDiS {
     const Mesh *mesh = drv->getFeSpace()->getMesh();
 
     // values on child[0]
-    DegreeOfFreedom cdof = el->getChild(0)->getDOF(mesh->getNode(VERTEX)+2, 
+    DegreeOfFreedom cdof = el->getChild(0)->getDof(mesh->getNode(VERTEX)+2, 
 						   admin->getNumberOfPreDOFs(VERTEX)); 
-    DegreeOfFreedom pdof = el->getDOF(mesh->getNode(EDGE)+2, admin->getNumberOfPreDOFs(EDGE)); 
+    DegreeOfFreedom pdof = el->getDof(mesh->getNode(EDGE)+2, admin->getNumberOfPreDOFs(EDGE)); 
     (*drv)[pdof] = (*drv)[cdof];
   }
 
@@ -4303,9 +4303,9 @@ namespace AMDiS {
     const DOFAdmin *admin = drv->getFeSpace()->getAdmin();
     const Mesh *mesh = drv->getFeSpace()->getMesh();
 
-    int cdof = el->getChild(0)->getDOF(mesh->getNode(VERTEX)+3, 
+    int cdof = el->getChild(0)->getDof(mesh->getNode(VERTEX)+3, 
 				       admin->getNumberOfPreDOFs(VERTEX)); 
-    int pdof = el->getDOF(mesh->getNode(EDGE), admin->getNumberOfPreDOFs(EDGE)); 
+    int pdof = el->getDof(mesh->getNode(EDGE), admin->getNumberOfPreDOFs(EDGE)); 
     (*drv)[pdof] = (*drv)[cdof];
   }
 
@@ -4331,39 +4331,39 @@ namespace AMDiS {
 
     int cdof, pdof;
 
-    if (el->getDOF(0, 0) < el->getDOF(1, 0))
-      pdof = el->getDOF(node + 2, n0);
+    if (el->getDof(0, 0) < el->getDof(1, 0))
+      pdof = el->getDof(node + 2, n0);
     else
-      pdof = el->getDOF(node + 2, n0 + 1);
+      pdof = el->getDof(node + 2, n0 + 1);
 
-    if (child->getDOF(1, 0) < child->getDOF(2, 0))
-      cdof = child->getDOF(node, n0 + 1);
+    if (child->getDof(1, 0) < child->getDof(2, 0))
+      cdof = child->getDof(node, n0 + 1);
     else
-      cdof = child->getDOF(node, n0);
+      cdof = child->getDof(node, n0);
       
     (*drv)[pdof] = (*drv)[cdof];
 
-    if (child->getDOF(2, 0) < child->getDOF(0, 0))
-      cdof = child->getDOF(node+1, n0);
+    if (child->getDof(2, 0) < child->getDof(0, 0))
+      cdof = child->getDof(node+1, n0);
     else
-      cdof = child->getDOF(node+1, n0+1);
+      cdof = child->getDof(node+1, n0+1);
       
-    (*drv)[el->getDOF(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER))] = 
+    (*drv)[el->getDof(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER))] = 
       (*drv)[cdof];
 
     // values on child[1] 
   
     child = el->getChild(1);
 
-    if (el->getDOF(0, 0) < el->getDOF(1, 0))
-      pdof = el->getDOF(node+2, n0+1);
+    if (el->getDof(0, 0) < el->getDof(1, 0))
+      pdof = el->getDof(node+2, n0+1);
     else
-      pdof = el->getDOF(node+2, n0);
+      pdof = el->getDof(node+2, n0);
 
-    if (child->getDOF(2, 0) < child->getDOF(0,0))
-      cdof = child->getDOF(node+1, n0);
+    if (child->getDof(2, 0) < child->getDof(0,0))
+      cdof = child->getDof(node+1, n0);
     else
-      cdof = child->getDOF(node+1, n0+1);
+      cdof = child->getDof(node+1, n0+1);
 
     (*drv)[pdof] = (*drv)[cdof];
 
@@ -4375,12 +4375,12 @@ namespace AMDiS {
     el = list->getElement(1);
     child = el->getChild(0);
 
-    if (child->getDOF(2,0) < child->getDOF(0, 0))
-      cdof = child->getDOF(node+1, n0);
+    if (child->getDof(2,0) < child->getDof(0, 0))
+      cdof = child->getDof(node+1, n0);
     else
-      cdof = child->getDOF(node+1, n0+1);
+      cdof = child->getDof(node+1, n0+1);
       
-    (*drv)[el->getDOF(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER))] = 
+    (*drv)[el->getDof(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER))] = 
       (*drv)[cdof];
   }
 
@@ -4406,39 +4406,39 @@ namespace AMDiS {
 
     int cdof, pdof;
 
-    if (el->getDOF(0, 0) < el->getDOF(1, 0))
-      pdof = el->getDOF(node+2, n0);
+    if (el->getDof(0, 0) < el->getDof(1, 0))
+      pdof = el->getDof(node+2, n0);
     else
-      pdof = el->getDOF(node+2, n0+1);
+      pdof = el->getDof(node+2, n0+1);
 
-    if (child->getDOF(1, 0) < child->getDOF(2, 0))
-      cdof = child->getDOF(node, n0+1);
+    if (child->getDof(1, 0) < child->getDof(2, 0))
+      cdof = child->getDof(node, n0+1);
     else
-      cdof = child->getDOF(node, n0);
+      cdof = child->getDof(node, n0);
       
     (*drv)[pdof] = (*drv)[cdof];
 
-    if (child->getDOF(2, 0) < child->getDOF(0, 0))
-      cdof = child->getDOF(node+1, n0);
+    if (child->getDof(2, 0) < child->getDof(0, 0))
+      cdof = child->getDof(node+1, n0);
     else
-      cdof = child->getDOF(node+1, n0+1);
+      cdof = child->getDof(node+1, n0+1);
       
-    (*drv)[el->getDOF(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER))] = 
+    (*drv)[el->getDof(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER))] = 
       (*drv)[cdof];
 
     // values on child[1]
   
     child = el->getChild(1);
 
-    if (el->getDOF(0, 0) < el->getDOF(1, 0))
-      pdof = el->getDOF(node+2, n0+1);
+    if (el->getDof(0, 0) < el->getDof(1, 0))
+      pdof = el->getDof(node+2, n0+1);
     else
-      pdof = el->getDOF(node+2, n0);
+      pdof = el->getDof(node+2, n0);
 
-    if (child->getDOF(2, 0) < child->getDOF(0, 0))
-      cdof = child->getDOF(node+1, n0);
+    if (child->getDof(2, 0) < child->getDof(0, 0))
+      cdof = child->getDof(node+1, n0);
     else
-      cdof = child->getDOF(node+1, n0+1);
+      cdof = child->getDof(node+1, n0+1);
 
     (*drv)[pdof] = (*drv)[cdof];
 
@@ -4450,12 +4450,12 @@ namespace AMDiS {
     el = list->getElement(1);
     child = el->getChild(0);
 
-    if (child->getDOF(2, 0) < child->getDOF(0, 0))
-      cdof = child->getDOF(node+1, n0);
+    if (child->getDof(2, 0) < child->getDof(0, 0))
+      cdof = child->getDof(node+1, n0);
     else
-      cdof = child->getDOF(node+1, n0+1);
+      cdof = child->getDof(node+1, n0+1);
       
-    (*drv)[el->getDOF(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER))] = 
+    (*drv)[el->getDof(mesh->getNode(CENTER), admin->getNumberOfPreDOFs(CENTER))] = 
       (*drv)[cdof];
   }
 
@@ -4480,8 +4480,8 @@ namespace AMDiS {
 
     // values on child[0]
 
-    const DegreeOfFreedom **pds = el->getDOF();
-    const DegreeOfFreedom **cds = el->getChild(0)->getDOF();
+    const DegreeOfFreedom **pds = el->getDof();
+    const DegreeOfFreedom **cds = el->getChild(0)->getDof();
 
     DegreeOfFreedom pd_o[20], cd, pd;
     basFct->getLocalIndices(el, admin, pd_o);
@@ -4489,17 +4489,17 @@ namespace AMDiS {
     cd = cds[0][0] < cds[3][0] ? cds[node_e+2][n0_e+1] : cds[node_e+2][n0_e];
     (*drv)[pd] = (*drv)[cd];
 
-    pd = el->getDOF(node_f+2, n0_f);
+    pd = el->getDof(node_f+2, n0_f);
     cd = cds[2][0] < cds[3][0] ? cds[node_e+5][n0_e+1] : cds[node_e+5][n0_e];
     (*drv)[pd] = (*drv)[cd];
 
-    pd = el->getDOF(node_f+3, n0_f); 
+    pd = el->getDof(node_f+3, n0_f); 
     cd = cds[1][0] < cds[3][0] ? cds[node_e+4][n0_e+1] : cds[node_e+4][n0_e];
     (*drv)[pd] = (*drv)[cd];
 
     // values on child[1]
 
-    cds = el->getChild(1)->getDOF();
+    cds = el->getChild(1)->getDof();
     pd = (pds[0][0] < pds[1][0]) ? pds[node_e][n0_e+1] : pds[node_e][n0_e];
     cd = cds[0][0] < cds[3][0] ? cds[node_e+2][n0_e+1] : cds[node_e+2][n0_e];
     (*drv)[pd] = (*drv)[cd];
@@ -4509,8 +4509,8 @@ namespace AMDiS {
     for (int i = 1; i < n; i++) {
       el = list->getElement(i);
       
-      pds = el->getDOF();
-      cds = el->getChild(0)->getDOF();
+      pds = el->getDof();
+      cds = el->getChild(0)->getDof();
       
       int lr_set = 0;
       if (list->getNeighbourElement(i, 0)  &&  list->getNeighbourNr(i, 0) < i)
@@ -4523,13 +4523,13 @@ namespace AMDiS {
 
       switch (lr_set) {
       case 1:
-	pd = el->getDOF(node_f+3, n0_f);
+	pd = el->getDof(node_f+3, n0_f);
 	cd = cds[1][0] < cds[3][0] ? 
 	  cds[node_e+4][n0_e+1] : cds[node_e+4][n0_e];
 	(*drv)[pd] = (*drv)[cd];
 	break;
       case 2:
-	pd = el->getDOF(node_f+2, n0_f);
+	pd = el->getDof(node_f + 2, n0_f);
 	cd = cds[2][0] < cds[3][0] ?
 	  cds[node_e+5][n0_e+1] : cds[node_e+5][n0_e];
 	(*drv)[pd] = (*drv)[cd];
diff --git a/AMDiS/src/MacroInfo.cc b/AMDiS/src/MacroInfo.cc
index 486d3c366713660668b42273a01bff7e70da9489..75781b38daa524ffa3bc5c93f348a23941701ae4 100644
--- a/AMDiS/src/MacroInfo.cc
+++ b/AMDiS/src/MacroInfo.cc
@@ -39,9 +39,7 @@ namespace AMDiS {
     for (int i = 0; i < nElements; i++) {
       mel[i]->element = mesh->createNewElement();
       mel[i]->index = i;
-
-      if (dim == 3)
-	mel[i]->elType = 0;
+      mel[i]->elType = 0;
     }
     neigh_set = false;
     bound_set = false;
diff --git a/AMDiS/src/MacroReader.cc b/AMDiS/src/MacroReader.cc
index e768087a08dd54bc26f8a06c9620498bb4e8bd44..535b9e5b915df42bd8b6f0f5b43f8177d07ce713 100644
--- a/AMDiS/src/MacroReader.cc
+++ b/AMDiS/src/MacroReader.cc
@@ -220,7 +220,7 @@ namespace AMDiS {
 	(*(mel + i))->setCoord(k, coords[melVertex[i][k]]);
 
 	const_cast<Element*>((*(mel + i))->getElement())->
-	  setDOF(k, dof[melVertex[i][k]]);
+	  setDof(k, dof[melVertex[i][k]]);
       }
     }
 
@@ -264,7 +264,7 @@ namespace AMDiS {
     int dim = mesh->getDim();
     mel = mesh->firstMacroElement();
     for (int i = 0; i < mesh->getNumberOfLeaves(); i++) {
-      MacroElement *macroEl = *(mel+i);
+      MacroElement *macroEl = *(mel + i);
       Projection *projector = macroEl->getProjection(0);
       if (projector && projector->getType() == VOLUME_PROJECTION) {
 	for (int j = 0; j <= dim; j++)
@@ -287,7 +287,7 @@ namespace AMDiS {
     if (mesh->getNumberOfDOFs(CENTER)) {
       for (int i = 0; i < mesh->getNumberOfMacros(); i++)
 	const_cast<Element*>(mel[i]->getElement())->
-	  setDOF(mesh->getNode(CENTER), mesh->getDof(CENTER));
+	  setDof(mesh->getNode(CENTER), mesh->getDof(CENTER));
     }
 
     /****************************************************************************/
@@ -353,12 +353,12 @@ namespace AMDiS {
 	if (mesh->getMacroElement(i)->getOppVertex(k) == AMDIS_UNDEFINED) {
 	  if (dim == 1) {
 	    dof[0] = const_cast<DegreeOfFreedom*>(mesh->getMacroElement(i)->
-						  getElement()->getDOF(k));
+						  getElement()->getDof(k));
 	  } else {
 	    for (int l = 0; l < dim; l++)
 	      dof[l] = const_cast<DegreeOfFreedom*>(mesh->getMacroElement(i)->
 						    getElement()->
-						    getDOF((k + l + 1) % (dim + 1)));
+						    getDof((k + l + 1) % (dim + 1)));
 	  }
 	  
 	  int j = 0;
@@ -445,16 +445,17 @@ namespace AMDiS {
 	    mesh->incrementNumberOfEdges(1);
 
 	    if (mesh->getNumberOfDOFs(EDGE)) {
-	      dof = el->setDOF(lnode + i, mesh->getDof(EDGE));
+	      dof = mesh->getDof(EDGE);
+	      el->setDof(lnode + i, dof);
       
 	      if ((*mel)->getNeighbour(i)) {
 		Element *neigh = 
 		  const_cast<Element*>((*mel)->getNeighbour(i)->getElement());
 
 		if (periodic[i])
-		  neigh->setDOF(lnode + (*mel)->getOppVertex(i), mesh->getDof(EDGE));
+		  neigh->setDof(lnode + (*mel)->getOppVertex(i), mesh->getDof(EDGE));
 		else
-		  neigh->setDOF(lnode + (*mel)->getOppVertex(i), dof);		
+		  neigh->setDof(lnode + (*mel)->getOppVertex(i), dof);		
 	      }
 	    }
 	  }  
@@ -505,16 +506,16 @@ namespace AMDiS {
 	  mesh->incrementNumberOfFaces(1);
 	
 	  if (mesh->getNumberOfDOFs(FACE)) {
-	    TEST_EXIT(!(*(mel + i))->getElement()->getDOF(lnode + k))
+	    TEST_EXIT(!(*(mel + i))->getElement()->getDof(lnode + k))
 	      ("dof %d on element %d already set\n", 
 	       lnode + k, (*(mel + i))->getIndex());
 	  
-	    const_cast<Element*>((*(mel + i))->getElement())->setDOF(lnode + k,
+	    const_cast<Element*>((*(mel + i))->getElement())->setDof(lnode + k,
 								     mesh->getDof(FACE));
 
 	    if (neigh) {
 	      ov = (*(mel + i))->getOppVertex(k);
-	      TEST_EXIT(!neigh->getElement()->getDOF(lnode + ov))
+	      TEST_EXIT(!neigh->getElement()->getDof(lnode + ov))
 		("dof %d on neighbour %d already set\n", 
 		 lnode + ov, neigh->getIndex());
 	    
@@ -522,10 +523,10 @@ namespace AMDiS {
 		const_cast<Element*>((*(mel + i))->getNeighbour(k)->getElement());
 
 	      if (periodic[k])
-		neighEl->setDOF(lnode+ov, mesh->getDof(FACE));
+		neighEl->setDof(lnode+ov, mesh->getDof(FACE));
 	      else
-		neighEl->setDOF(lnode+ov, const_cast<int*>((*(mel + i))->getElement()->
-							   getDOF(lnode + k)));	      
+		neighEl->setDof(lnode+ov, const_cast<int*>((*(mel + i))->getElement()->
+							   getDof(lnode + k)));	      
 	    }
 	  }
 	}
@@ -697,19 +698,20 @@ namespace AMDiS {
 
     if (mesh->getNumberOfDOFs(EDGE)) {
       node = mesh->getNode(EDGE);
-      if (el->getDOF(node+edge_no)) {
+      if (el->getDof(node+edge_no)) {
 	/****************************************************************************/
 	/*  edge was counted by another macro element and dof was added on the      */
 	/*  complete patch                                                          */
 	/****************************************************************************/
 	return false;
       } else {
-	edge_dof = el->setDOF(node+edge_no,mesh->getDof(EDGE));
+	edge_dof = mesh->getDof(EDGE);
+	el->setDof(node+edge_no, edge_dof);
       }
     }
 
     for (j = 0; j < 2; j++)
-      dof[j] = el->getDOF(el->getVertexOfEdge(edge_no, j));
+      dof[j] = el->getDof(el->getVertexOfEdge(edge_no, j));
     
     /****************************************************************************/
     /*  first look for all neighbours in one direction until a boundary is      */
@@ -730,9 +732,9 @@ namespace AMDiS {
 
     while (nei  &&  nei != mel) {
       for (j = 0; j < vertices; j++)
-	if (nei->getElement()->getDOF(j) == dof[0])  break;
+	if (nei->getElement()->getDof(j) == dof[0])  break;
       for (k = 0; k < vertices; k++)
-	if (nei->getElement()->getDOF(k) == dof[1])  break;
+	if (nei->getElement()->getDof(k) == dof[1])  break;
 
       // check for periodic boundary
       if (j == 4 || k == 4) {
@@ -760,7 +762,7 @@ namespace AMDiS {
 	&(nei->projection[mesh->getGeo(FACE)+edge_no]);
 
       if (mesh->getNumberOfDOFs(EDGE))
-	nei->element->setDOF(node+edge_no,edge_dof);      
+	nei->element->setDof(node+edge_no,edge_dof);      
 
       if (next_el[edge_no][0] != opp_v) {
 	if (nei->getBoundary(next_el[edge_no][0])) {
@@ -813,9 +815,9 @@ namespace AMDiS {
       
       while (nei) {
 	for (j = 0; j < vertices; j++)
-	  if (nei->getElement()->getDOF(j) == dof[0])  break;
+	  if (nei->getElement()->getDof(j) == dof[0])  break;
 	for (k = 0; k < vertices; k++)
-	  if (nei->getElement()->getDOF(k) == dof[1])  break;
+	  if (nei->getElement()->getDof(k) == dof[1])  break;
 	
 	// check for periodic boundary
 	if (j == 4 || k == 4)
@@ -838,11 +840,11 @@ namespace AMDiS {
 	list_project[(*n_neigh)++] = &(nei->projection[mesh->getGeo(FACE) + edge_no]);
 
 	if (mesh->getNumberOfDOFs(EDGE)) {
-	  TEST_EXIT(!nei->getElement()->getDOF(node+edge_no))
+	  TEST_EXIT(!nei->getElement()->getDof(node+edge_no))
 	    ("dof %d on element %d is already set, but not on element %d\n",
 	     node + edge_no, nei->getIndex(), mel_index);
 	  
-	  nei->element->setDOF(node+edge_no, edge_dof);
+	  nei->element->setDof(node+edge_no, edge_dof);
 	}
 
 	if (next_el[edge_no][0] != opp_v) {
@@ -938,7 +940,7 @@ namespace AMDiS {
       }    
   
       for (i = 0; i < 7; i++)
-	d[i] = const_cast<int*>(me->getElement()->getDOF(i));      
+	d[i] = const_cast<int*>(me->getElement()->getDof(i));      
 
       if (ka == 1) { 
 	me->coord[0] = macr->coord[2];
@@ -965,17 +967,17 @@ namespace AMDiS {
 	if (mesh->getNumberOfDOFs(VERTEX)) {                /* Ecken */
 	  n0 = mesh->getNode(VERTEX);              
         
-	  const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+2]);     
-	  const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0]);  
-	  const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0+1]);   
+	  const_cast<Element*>(me->getElement())->setDof(n0,d[n0+2]);     
+	  const_cast<Element*>(me->getElement())->setDof(n0+1,d[n0]);  
+	  const_cast<Element*>(me->getElement())->setDof(n0+2,d[n0+1]);   
 	}
  
 	if (mesh->getNumberOfDOFs(EDGE)) {                  /* Kanten */
 	  n0 = mesh->getNode(EDGE);    
        
-	  const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+2]);  
-	  const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0]);  
-	  const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0+1]);
+	  const_cast<Element*>(me->getElement())->setDof(n0,d[n0+2]);  
+	  const_cast<Element*>(me->getElement())->setDof(n0+1,d[n0]);  
+	  const_cast<Element*>(me->getElement())->setDof(n0+2,d[n0+1]);
 	} 
       } else {
 	me->coord[0] = macr->coord[1];
@@ -1001,17 +1003,17 @@ namespace AMDiS {
 	if (mesh->getNumberOfDOFs(VERTEX)) {                /* Ecken */
 	  n0 = mesh->getNode(VERTEX);              
         
-	  const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+1]);     
-	  const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0+2]);  
-	  const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0]);   
+	  const_cast<Element*>(me->getElement())->setDof(n0,d[n0+1]);     
+	  const_cast<Element*>(me->getElement())->setDof(n0+1,d[n0+2]);  
+	  const_cast<Element*>(me->getElement())->setDof(n0+2,d[n0]);   
 	}
  
 	if (mesh->getNumberOfDOFs(EDGE)) {                  /* Kanten */
 	  n0 = mesh->getNode(EDGE);    
        
-	  const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+1]);  
-	  const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0+2]);  
-	  const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0]);
+	  const_cast<Element*>(me->getElement())->setDof(n0,d[n0+1]);  
+	  const_cast<Element*>(me->getElement())->setDof(n0+1,d[n0+2]);  
+	  const_cast<Element*>(me->getElement())->setDof(n0+2,d[n0]);
 	} 
       }
   
@@ -1292,7 +1294,7 @@ namespace AMDiS {
 	
 	if (elinfo->getBoundary(i) > 0) {  // < 0 => periodic boundary
 	  if (dim == 1) {
-	    if (el->getDOF(i) != neig->getDOF(opp_v)) {
+	    if (el->getDof(i) != neig->getDof(opp_v)) {
 	      if (!error_detected)
 		MSG("error detected!!!\n");
 	      error_detected++;
@@ -1301,8 +1303,8 @@ namespace AMDiS {
 	  } else {
 	    for (j = 1; j < mesh->getGeo(VERTEX); j++) {
 	      for (k = 1; k < mesh->getGeo(VERTEX); k++)
-		if (el->getDOF((i+j) % mesh->getGeo(VERTEX)) == 
-		    neig->getDOF((opp_v+k) % mesh->getGeo(VERTEX))) 
+		if (el->getDof((i+j) % mesh->getGeo(VERTEX)) == 
+		    neig->getDof((opp_v+k) % mesh->getGeo(VERTEX))) 
 		  break;
 	      
 	      if (k >= mesh->getGeo(VERTEX)) {
@@ -1310,7 +1312,7 @@ namespace AMDiS {
 		  MSG("error detected!!!\n");
 		error_detected++;
 		MSG("dof %d of el %d at face %d isn't dof of neigh %d at face %d\n",
-		    el->getDOF((i+j) % 3,0), el->getIndex(), i, neig->getIndex(), 
+		    el->getDof((i+j) % 3,0), el->getIndex(), i, neig->getIndex(), 
 		    opp_v);
 	      }	   
 	    }
@@ -1350,7 +1352,7 @@ namespace AMDiS {
 	 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) {
+	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++) {
@@ -1377,7 +1379,7 @@ namespace AMDiS {
 	int i0 = mesh->getNode(EDGE);
 	
 	for (int i = 0; i < mesh->getGeo(EDGE); i++) {
-	  dof = el->getDOF(i0 + i);
+	  dof = el->getDof(i0 + i);
 
 	  if (dof == NULL) {
 	    ERROR("no edge dof %d on element %d\n", i, el->getIndex());
@@ -1396,9 +1398,9 @@ namespace AMDiS {
 	      if (neig) {
 		int ov = elinfo->getOppVertex(i);
 
-		TEST(neig->getDOF(i0 + ov) == dof)
+		TEST(neig->getDof(i0 + ov) == dof)
 		  ("el %d edge %d dof %8X: wrong dof %8X in neighbour %d edge %d\n",
-		   el->getIndex(), i, dof, neig->getDOF(i0 + ov), 
+		   el->getIndex(), i, dof, neig->getDof(i0 + ov), 
 		   neig->getIndex(), ov);
 	      }
 	    } else { // dim == 3
@@ -1408,7 +1410,7 @@ namespace AMDiS {
 		    (neig = elinfo->getNeighbour(in))) {
 		  int found = 0;
 		  for (int k = 0; k < mesh->getGeo(EDGE); k++) {
-		    if (neig->getDOF(i0 + k) == dof) found++;
+		    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());
@@ -1429,7 +1431,7 @@ namespace AMDiS {
 	   j0, ndof, mesh->getNumberOfDOFs(FACE));
 	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);
+	  TEST(dof = el->getDof(i0 + i))("no face dof %d ???\n", i);
 	  for (int j = 0; j < ndof; j++) {
 	    int jdof = dof[j0 + j];
 	    TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
@@ -1441,9 +1443,9 @@ namespace AMDiS {
 	    if ((neig = elinfo->getNeighbour(i))) {
 	      int ov = elinfo->getOppVertex(i);
 
-	      TEST(neig->getDOF(i0 + ov) == dof)
+	      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(),
+		 el->getIndex(), i, dof, neig->getDof(i0 + ov), neig->getIndex(),
 		 ov);
 	    }
 	  }
@@ -1454,7 +1456,7 @@ namespace AMDiS {
     ndof = admin.getNumberOfDOFs(CENTER);
     if (ndof) {
       int i0 = mesh->getNode(CENTER);
-      TEST(dof = el->getDOF(i0))("no center dof???\n");
+      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",
@@ -1475,7 +1477,7 @@ namespace AMDiS {
     Element *el = elinfo->getElement();
     MSG("el %4d: ", el->getIndex());
     for (int i = 0; i < mesh->getGeo(VERTEX); i++)
-      Msg::print("%4d%s", el->getDOF(i,0), 
+      Msg::print("%4d%s", el->getDof(i,0), 
 		 i < mesh->getGeo(VERTEX)-1 ? ", " : "\n");
   }
 }
diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc
index 95dd4d4e665090560ec61716ab820fb140c6c0e0..285a1993e89fbf43a18c0e483c9a6e499a085640 100644
--- a/AMDiS/src/Mesh.cc
+++ b/AMDiS/src/Mesh.cc
@@ -270,24 +270,26 @@ namespace AMDiS {
     TEST_EXIT(admin.size() == 1)("Not yet implemented for multiple admins!\n");
     TEST_EXIT(admin[0])("There is something wrong!\n");
 
-    ElementDofIterator elDofIter(feSpace);
+    // === Determine to all dofs the macro elements where the dof is part of. ===
 
     // Map that stores for each dof pointer (which may have a list of dofs)
     // all macro element indices that own this dof.
     DofElMap dofsOwner;
     DofPosMap dofsPosIndex;
 
-
-    // === Determine to all dofs the macro elements where the dof is part of. ===
-
-    for (std::deque<MacroElement*>::iterator macroIt = macroElements.begin();
-	 macroIt != macroElements.end(); ++macroIt) {
-      elDofIter.reset((*macroIt)->getElement());
+    ElementDofIterator elDofIter(feSpace);
+    TraverseStack stack;
+    ElInfo *elInfo = stack.traverseFirst(this, -1, Mesh::CALL_LEAF_EL);
+    while (elInfo) {
+      elDofIter.reset(elInfo->getElement());
       do {
-	dofsOwner[elDofIter.getDofPtr()].insert(*macroIt);
+	dofsOwner[elDofIter.getDofPtr()].insert(elInfo->getMacroElement());
 	dofsPosIndex[elDofIter.getDofPtr()] = elDofIter.getPosIndex();
       } while (elDofIter.nextStrict());
-    }
+
+      elInfo = stack.traverseNext(elInfo);
+    }		   
+
 
     // === Remove macro elements from mesh macro element list. ===
 
@@ -310,35 +312,31 @@ namespace AMDiS {
 
 
     // === For all macro elements to be deleted, delete them also to be neighbours ===
-    // === of some other macro elements.                                           ===
+    // === of some other macro elements. Furtheremore, delete the whole element    ===
+    // === hierarchie structure of the macro element.                              ===
     
     for (std::set<MacroElement*>::iterator macroIt = macros.begin();
 	 macroIt != macros.end(); ++macroIt) {
 
       // Go through all neighbours of the macro element and remove this macro element
       // to be neighbour of some other macro element.
-      for (int i = 0; i <= dim; i++) {
-	if ((*macroIt)->getNeighbour(i)) {
+      for (int i = 0; i <= dim; i++)
+	if ((*macroIt)->getNeighbour(i))
 	  for (int j = 0; j <= dim; j++)
 	    if ((*macroIt)->getNeighbour(i)->getNeighbour(j) == *macroIt)
 	      (*macroIt)->getNeighbour(i)->setNeighbour(j, NULL);
-	} else {
-	  // There is no neighbour at this edge, so we have to decrease the number
-	  // of edges in the mesh.
-	  nEdges--;
-	}
-      }
 
-      // Decrease also the number of elements of the mesh.
-      nLeaves--;
-      nElements--;
+      // Delete element hierarchie
+      if (!(*macroIt)->getElement()->isLeaf()) {
+	delete (*macroIt)->getElement()->getChild(0);
+	delete (*macroIt)->getElement()->getChild(1);
+      }
     }     
 
 
     // === Check now all the dofs, that have no owner anymore and therefore have ===
     // === to be removed.                                                        ===
 
-    int nRemainDofs = 0;
     for (DofElMap::iterator dofsIt = dofsOwner.begin(); 
 	 dofsIt != dofsOwner.end(); ++dofsIt) {
       
@@ -356,18 +354,36 @@ namespace AMDiS {
       if (deleteDof)
 	freeDof(const_cast<DegreeOfFreedom*>(dofsIt->first), 
 		dofsPosIndex[dofsIt->first]);
-      else
-	nRemainDofs++;
     }
 
 
-    // === Finally, remove the macro elements from memory. ===
+    // === Update number of elements, vertices, etc. ===
 
-    for (std::set<MacroElement*>::iterator macroIt = macros.begin();
-	 macroIt != macros.end(); ++macroIt)
-      delete *macroIt;
+    nLeaves = 0;
+    nElements = 0;
+
+    std::set<const DegreeOfFreedom*> allVertices;
+
+    elInfo = stack.traverseFirst(this, -1, Mesh::CALL_EVERY_EL_PREORDER);
+    while (elInfo) {
+      nElements++;
+
+      if (elInfo->getElement()->isLeaf()) {
+	nLeaves++;
+
+	for (int i = 0; i < getGeo(VERTEX); i++)
+	  allVertices.insert(elInfo->getElement()->getDof(i));
+      }
 
-    nVertices = nRemainDofs;
+      elInfo = stack.traverseNext(elInfo);
+    }
+
+    nVertices = allVertices.size();
+
+    // === Note: Although the macro elements are removed from the mesh,   ===
+    // === they are not deleted from memory. The macro elements are still ===
+    // === stored in macroInfo structure. They are needed, if the mesh is ===
+    // === redistributed between the ranks.                               ===
   }
 
 
@@ -584,7 +600,7 @@ namespace AMDiS {
     TEST_EXIT_DBG(ndof <= MAX_DOF)
       ("ndof too big: ndof = %d, MAX_DOF = %d\n", ndof, MAX_DOF);
 
-    for (int i = 0; i < static_cast<int>(admin.size()); i++) {
+    for (unsigned int i = 0; i < admin.size(); i++) {
       DOFAdmin *localAdmin = admin[i];
       int n = localAdmin->getNumberOfDOFs(position);
       int n0 = localAdmin->getNumberOfPreDOFs(position);
@@ -602,7 +618,7 @@ namespace AMDiS {
 
   void Mesh::freeElement(Element* el)
   {
-    freeDOFPtrs(const_cast<DegreeOfFreedom**>(el->getDOF()));
+    freeDOFPtrs(const_cast<DegreeOfFreedom**>(el->getDof()));
     delete el;
   }
 
@@ -1145,7 +1161,6 @@ namespace AMDiS {
     GET_PARAMETER(0, name + "->preserve coarse dofs", "%d", &preserveCoarseDOFs);
 
     if (macroFilename.length()) {
-
 #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
       if (checkParallelMacroFile(macroFilename, periodicFilename, check)) {
  	std::string newPeriodicFilename = "";
@@ -1159,18 +1174,20 @@ namespace AMDiS {
 	macroFileInfo = 
 	  MacroReader::readMacro(macroFilename, this, periodicFilename, check);
       }
-
 #else
       // In sequentiel computations just read the macro file to the mesh.
       macroFileInfo = 
 	MacroReader::readMacro(macroFilename, this, periodicFilename, check);
 #endif
 
-      // If there is no value file which should be written, we can delete
-      // the information of the macro file.
+      // In the sequentiell case, if there is no value file which should 
+      // be written, we can delete the information of the macro file. In
+      // parallel computations, the macro file infos are always needed for
+      // mesh repartitioning.
+#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
       if (!valueFilename.length())
-  	clearMacroFileInfo();
-
+       	clearMacroFileInfo();
+#endif
     }
 
     initialized = true;
@@ -1200,6 +1217,8 @@ namespace AMDiS {
     
     MacroInfo *testMacroInfo = 
       MacroReader::readMacro(macroFilename, &testMesh, periodicFilename, check);
+    testMacroInfo->clear();
+    delete testMacroInfo;
 
 
     // === Check the mesh structure. ===
diff --git a/AMDiS/src/Mesh.h b/AMDiS/src/Mesh.h
index 4338c29bd9389131f5952873cb2a7b64bf43361e..9a307e2e6dafaf1761939a6158a9ec54c4a668a9 100644
--- a/AMDiS/src/Mesh.h
+++ b/AMDiS/src/Mesh.h
@@ -240,17 +240,18 @@ namespace AMDiS {
       return macroElements[i]; 
     }
 
-    std::deque<MacroElement*>& getMacroElements()
-    {
-      return macroElements;
-    }
-
     /// Returns an iterator to the end of \ref macroElements
     inline std::deque<MacroElement*>::iterator endOfMacroElements() 
     {
       return macroElements.end();
     }
 
+    /// Returns \ref macroElements, the list of all macro elements in the mesh.
+    std::deque<MacroElement*>& getMacroElements()
+    {
+      return macroElements;
+    }
+
     /** \} */
 
     /** \name setting methods
diff --git a/AMDiS/src/MeshStructure.cc b/AMDiS/src/MeshStructure.cc
index ed477f9525435436fe26892be81fe874c3dddcfb..71d98b35cdf3ac25ec5f46611c730dd6712488ad 100644
--- a/AMDiS/src/MeshStructure.cc
+++ b/AMDiS/src/MeshStructure.cc
@@ -42,14 +42,17 @@ namespace AMDiS {
   }
 
 
-  void MeshStructure::init(Mesh *mesh) 
+  void MeshStructure::init(Mesh *mesh, int macroElIndex) 
   {
     clear();
 
     TraverseStack stack;
     ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER);
     while (elInfo) {
-      insertElement(elInfo->getElement()->isLeaf());
+      if (macroElIndex == -1 ||
+	  elInfo->getMacroElement()->getIndex() == macroElIndex)
+	insertElement(elInfo->getElement()->isLeaf());
+
       elInfo = stack.traverseNext(elInfo);
     }
   
@@ -236,14 +239,13 @@ namespace AMDiS {
     // decorate leaf data
     reset();
     TraverseStack stack;
-    ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER);
-    while (elInfo) {
-      if (macroElIndex >= 0 && 
-	  elInfo->getMacroElement()->getElement()->getIndex() != macroElIndex) {
-	elInfo = stack.traverseNext(elInfo);
-	continue;
-      }
+    ElInfo *elInfo = NULL;
+    if (macroElIndex == -1)
+      elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER);
+    else
+      elInfo = stack.traverseFirstOneMacro(mesh, macroElIndex, -1, Mesh::CALL_EVERY_EL_PREORDER);
 
+    while (elInfo) {
       Element *element = elInfo->getElement();
 
       TEST_EXIT(cont)("unexpected structure code end!\n");
@@ -281,14 +283,11 @@ namespace AMDiS {
 
     do {
       finished = true;
-      elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
+      if (macroElIndex == -1)
+	elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
+      else
+	elInfo = stack.traverseFirstOneMacro(mesh, macroElIndex, -1, Mesh::CALL_LEAF_EL);      
       while (elInfo) {
-	if (macroElIndex >= 0 && 
-	    elInfo->getMacroElement()->getElement()->getIndex() != macroElIndex) {
-	  elInfo = stack.traverseNext(elInfo);
-	  continue;
-	}
-
 	Element *element = elInfo->getElement();
 	if (element->getElementData(MESH_STRUCTURE) != NULL) {
 	  element->setMark(1);
@@ -298,7 +297,22 @@ namespace AMDiS {
 	}
 	elInfo = stack.traverseNext(elInfo);
       }
-      manager->refineMesh(mesh);
+
+      if (!finished) {
+#if (DEBUG != 0)
+	int oldMeshIndex = mesh->getChangeIndex();
+#endif
+	
+	if (macroElIndex == -1)
+	  manager->refineMesh(mesh);
+	else
+	  manager->refineMacroElement(mesh, macroElIndex);
+	
+#if (DEBUG != 0)
+	TEST_EXIT(oldMeshIndex != mesh->getChangeIndex())
+	  ("Mesh has not been changed by refinement procedure!\n");
+#endif
+      }
     } while (!finished);
   }
 
diff --git a/AMDiS/src/MeshStructure.h b/AMDiS/src/MeshStructure.h
index 58621682da800448e28a5d7bec916d5c4d52cb9e..b07842aebe840fcd81e53f64f809620cf270a58e 100644
--- a/AMDiS/src/MeshStructure.h
+++ b/AMDiS/src/MeshStructure.h
@@ -23,6 +23,8 @@
 #define AMDIS_MESH_STRUCTURE_H
 
 #include <vector>
+#include <stdint.h>
+
 #include "AMDiS_fwd.h"
 #include "Global.h"
 #include "parallel/InteriorBoundary.h"
@@ -43,8 +45,16 @@ namespace AMDiS {
   
     void clear();
 
-    /// Creates a mesh structure code from a mesh object by traversing it in preorder.
-    void init(Mesh *mesh);
+    /** \brief
+     * Creates a mesh structure code from a mesh object by traversing it in 
+     * preorder.
+     *
+     * \param[in]  mesh           Mesh that is used to create the structure code.
+     * \param[in]  macroElIndex   If the value is set to -1, the structure code is
+     *                            created for the whole mesh. Otherwise, it is done
+     *                            only for the macro element with this index.
+     */
+    void init(Mesh *mesh, int macroElIndex = -1);
    
     void init(BoundaryObject &bound);
 
diff --git a/AMDiS/src/Parametric.cc b/AMDiS/src/Parametric.cc
index ff89f272fb1af6bd0223de347dfdabb706626f2c..ee443be29f5a61bd471425dcd112b9affed77898 100644
--- a/AMDiS/src/Parametric.cc
+++ b/AMDiS/src/Parametric.cc
@@ -10,7 +10,7 @@ namespace AMDiS {
     elInfo->setParametric(true);
     int dow = Global::getGeo(WORLD);
     Element *element = elInfo->getElement();
-    const DegreeOfFreedom **dof = element->getDOF();
+    const DegreeOfFreedom **dof = element->getDof();
   
     for (int i = 0; i < elInfo->getElement()->getGeo(VERTEX); i++) {
       if (elInfo->getFillFlag().isSet(Mesh::FILL_COORDS))
@@ -22,7 +22,7 @@ namespace AMDiS {
 	  ("FILL_NEIGH not set\n");
 
 	if (elInfo->getNeighbour(i)) {
-	  const DegreeOfFreedom **neighDof = elInfo->getNeighbour(i)->getDOF();
+	  const DegreeOfFreedom **neighDof = elInfo->getNeighbour(i)->getDof();
 	  for (int j = 0; j < dow; j++)
 	    elInfo->getOppCoord(i)[j] = 
 	      (*(*dofCoords_)[j])[neighDof[elInfo->getOppVertex(i)][0]];	  
diff --git a/AMDiS/src/PeriodicBC.cc b/AMDiS/src/PeriodicBC.cc
index d4e13ec1f5939c206dfa38d6f4159f6de86a0e09..ddf4f2abff807532b97554941934fb6fd1245490 100644
--- a/AMDiS/src/PeriodicBC.cc
+++ b/AMDiS/src/PeriodicBC.cc
@@ -164,7 +164,7 @@ namespace AMDiS {
 
 		int j = 0;
 		for (; j < dim + 1; j++)
-		  if (neigh->getDOF(j, 0) == periodicDOF) 
+		  if (neigh->getDof(j, 0) == periodicDOF) 
 		    break;
 
 		vertexPermutation[i] = j;
diff --git a/AMDiS/src/RCNeighbourList.cc b/AMDiS/src/RCNeighbourList.cc
index 945047d8726393899f6c6bf1ddd2bedbe9e709e8..dce07e57f8df9dd78c332f9228017606135ba291 100644
--- a/AMDiS/src/RCNeighbourList.cc
+++ b/AMDiS/src/RCNeighbourList.cc
@@ -113,7 +113,7 @@ namespace AMDiS {
 	  
 	  int k = 0;
 	  for (; k < 2; k++) {
-	    if (neigh->getDOF(2+k) == el->getDOF(3-dir)) {
+	    if (neigh->getDof(2+k) == el->getDof(3-dir)) {
 	      rclist[i]->neigh[dir] = rclist[j];
 	      rclist[i]->oppVertex[dir] = 3-k;
 	      break;
@@ -146,22 +146,22 @@ namespace AMDiS {
       /*  set the dof in the coarsening edge                                      */
       /****************************************************************************/
       
-      el->setDOF(node, dof);
+      el->setDof(node, dof);
       
       /****************************************************************************/
       /*  and now those handed on by the children                                 */
       /****************************************************************************/
       
-      el->setDOF(node + 1, const_cast<int*>( el->getFirstChild()->getDOF(node)));
-      el->setDOF(node + 2, const_cast<int*>( el->getFirstChild()->getDOF(node + 1)));
-      el->setDOF(node + 5, const_cast<int*>( el->getFirstChild()->getDOF(node + 3)));
+      el->setDof(node + 1, const_cast<int*>( el->getFirstChild()->getDof(node)));
+      el->setDof(node + 2, const_cast<int*>( el->getFirstChild()->getDof(node + 1)));
+      el->setDof(node + 5, const_cast<int*>( el->getFirstChild()->getDof(node + 3)));
       
       if (coarse_list->elType) {
-	el->setDOF(node + 3, const_cast<int*>( el->getSecondChild()->getDOF(node)));
-	el->setDOF(node + 4, const_cast<int*>( el->getSecondChild()->getDOF(node + 1)));
+	el->setDof(node + 3, const_cast<int*>( el->getSecondChild()->getDof(node)));
+	el->setDof(node + 4, const_cast<int*>( el->getSecondChild()->getDof(node + 1)));
       } else {
-	el->setDOF(node + 3, const_cast<int*>( el->getSecondChild()->getDOF(node + 1)));
-	el->setDOF(node + 4, const_cast<int*>( el->getSecondChild()->getDOF(node)));
+	el->setDof(node + 3, const_cast<int*>( el->getSecondChild()->getDof(node + 1)));
+	el->setDof(node + 4, const_cast<int*>( el->getSecondChild()->getDof(node)));
       }
     }
 
@@ -174,37 +174,37 @@ namespace AMDiS {
       
       neighbour = coarse_list->neigh[0];
       if (!neighbour || neighbour > coarse_list) {
-	if (!el->getDOF(node + 2)) {
+	if (!el->getDof(node + 2)) {
 	  // face 2
-	  el->setDOF(node + 2, const_cast<int*>(coarse_mesh->getDof(FACE)));
+	  el->setDof(node + 2, const_cast<int*>(coarse_mesh->getDof(FACE)));
 	  if (neighbour)
-	    neighbour->el->setDOF(node + coarse_list->oppVertex[0], 
-				  const_cast<int*>(el->getDOF(node + 2)));
+	    neighbour->el->setDof(node + coarse_list->oppVertex[0], 
+				  const_cast<int*>(el->getDof(node + 2)));
 	}
       }
       
       neighbour = coarse_list->neigh[1];
       if (!neighbour || neighbour > coarse_list) {
-	if (!el->getDOF(node + 3)) {
+	if (!el->getDof(node + 3)) {
 	  // face 3
-	  el->setDOF(node + 3, const_cast<int*>(coarse_mesh->getDof(FACE)));
+	  el->setDof(node + 3, const_cast<int*>(coarse_mesh->getDof(FACE)));
 	  if (neighbour)
-	    neighbour->el->setDOF(node + coarse_list->oppVertex[1], 
-				  const_cast<int*>(el->getDOF(node + 3)));
+	    neighbour->el->setDof(node + coarse_list->oppVertex[1], 
+				  const_cast<int*>(el->getDof(node + 3)));
 	}
       }
       /****************************************************************************/
       /*  and now those handed on by the children                                 */
       /****************************************************************************/
 
-      el->setDOF(node, const_cast<int*>(el->getSecondChild()->getDOF(node + 3)));
-      el->setDOF(node + 1, const_cast<int*>(el->getFirstChild()->getDOF(node + 3)));
+      el->setDof(node, const_cast<int*>(el->getSecondChild()->getDof(node + 3)));
+      el->setDof(node + 1, const_cast<int*>(el->getFirstChild()->getDof(node + 3)));
     }
     
     if (coarse_mesh->getNumberOfDOFs(CENTER)) {
       int node = coarse_mesh->getNode(CENTER);
-      if (!el->getDOF(node))
-	el->setDOF(node, const_cast<int*>(coarse_mesh->getDof(CENTER)));
+      if (!el->getDof(node))
+	el->setDof(node, const_cast<int*>(coarse_mesh->getDof(CENTER)));
     }
   }
 
@@ -219,8 +219,8 @@ namespace AMDiS {
       /*  get dofs on the boundary of the coarsening patch from the children      */
       /****************************************************************************/
       for (int i = 0; i < n_neigh; i++) {
-	rclist[i]->el->setDOF(node, const_cast<int*>(rclist[i]->el->getSecondChild()->getDOF(node + 2)));
-	rclist[i]->el->setDOF(node + 1, const_cast<int*>(rclist[i]->el->getFirstChild()->getDOF(node + 2)));
+	rclist[i]->el->setDof(node, const_cast<int*>(rclist[i]->el->getSecondChild()->getDof(node + 2)));
+	rclist[i]->el->setDof(node + 1, const_cast<int*>(rclist[i]->el->getFirstChild()->getDof(node + 2)));
       }
     }
 
@@ -231,8 +231,8 @@ namespace AMDiS {
       /*  get new dof on parents at the barycenter                                */
       /****************************************************************************/
       for (int i = 0; i < n_neigh; i++)
-	if (!rclist[i]->el->getDOF(node))
-	  rclist[i]->el->setDOF(node, const_cast<int*>(coarse_mesh->getDof(CENTER)));
+	if (!rclist[i]->el->getDof(node))
+	  rclist[i]->el->setDof(node, const_cast<int*>(coarse_mesh->getDof(CENTER)));
     }
   }
 
@@ -247,14 +247,14 @@ namespace AMDiS {
 
 	for (int i = 0; i < n_neigh; i++)
 	  for (int j = 0; j < edges; j++)
-	    rclist[i]->el->setDOF(node + j, NULL);
+	    rclist[i]->el->setDof(node + j, NULL);
     }
 
     if (mesh->getNumberOfDOFs(CENTER)) {
       int node = mesh->getNode(CENTER);
       for (int i = 0; i < n_neigh; i++) {
-	mesh->freeDof(const_cast<int*>(rclist[i]->el->getDOF(node)), CENTER);
-	rclist[i]->el->setDOF(node, NULL);
+	mesh->freeDof(const_cast<int*>(rclist[i]->el->getDof(node)), CENTER);
+	rclist[i]->el->setDof(node, NULL);
       }
     }
   }
@@ -271,7 +271,7 @@ namespace AMDiS {
     if (mesh->getNumberOfDOFs(EDGE)) {
       int node = mesh->getNode(EDGE);
       for (int j = 0; j < edges; j++)
-	el->setDOF(node + j, NULL);
+	el->setDof(node + j, NULL);
     }
 
     if (mesh->getNumberOfDOFs(FACE)) {
@@ -280,21 +280,21 @@ namespace AMDiS {
 
       // face 2
       if (!neigh || neigh > rclist[index])
-	mesh->freeDof(const_cast<int*>(el->getDOF(node + 2)), FACE);
+	mesh->freeDof(const_cast<int*>(el->getDof(node + 2)), FACE);
       
       neigh = rclist[index]->neigh[1];
       // face 3
       if (!neigh || neigh > rclist[index])
-	mesh->freeDof(const_cast<int*>(el->getDOF(node + 3)), FACE);
+	mesh->freeDof(const_cast<int*>(el->getDof(node + 3)), FACE);
       
       for (int j = 0; j < faces; j++)
-	el->setDOF(node + j, NULL);
+	el->setDof(node + j, NULL);
     }
   
     if (mesh->getNumberOfDOFs(CENTER)) {
       int node = mesh->getNode(CENTER);
-      mesh->freeDof(const_cast<int*>(el->getDOF(node)), CENTER);
-      el->setDOF(node, NULL);
+      mesh->freeDof(const_cast<int*>(el->getDof(node)), CENTER);
+      el->setDof(node, NULL);
     }
   }
 
@@ -317,8 +317,8 @@ namespace AMDiS {
     std::vector<RCListElement*>::iterator insertIt;
 
     while (count < n_neigh_old) {
-      DegreeOfFreedom *dof0 = const_cast<DegreeOfFreedom*>((*it)->el->getDOF(0));
-      DegreeOfFreedom *dof1 = const_cast<DegreeOfFreedom*>((*it)->el->getDOF(1));
+      DegreeOfFreedom *dof0 = const_cast<DegreeOfFreedom*>((*it)->el->getDof(0));
+      DegreeOfFreedom *dof1 = const_cast<DegreeOfFreedom*>((*it)->el->getDof(1));
 
       if (dof0 != edge[0] && dof0 != edge[1]) {
 	secondPart = true;
diff --git a/AMDiS/src/Recovery.cc b/AMDiS/src/Recovery.cc
index e591edff068f575b396db888840ed32407fed291..659b93ba1d35651e3e42e476c40f7e06b4d9cbe0 100644
--- a/AMDiS/src/Recovery.cc
+++ b/AMDiS/src/Recovery.cc
@@ -382,7 +382,7 @@ void Recovery::compute_node_sums(DOFVector<double> *uh, ElInfo *elInfo,
     ("At the moment only for linear finite elements.\n");
 
   WorldVector<double> node;  // For world coordinates at nodes.
-  const DegreeOfFreedom **dof = elInfo->getElement()->getDOF();
+  const DegreeOfFreedom **dof = elInfo->getElement()->getDof();
   ElementVector uh_loc(n_vertices);
   uh->getLocalVector(elInfo->getElement(), uh_loc);
 
@@ -416,7 +416,7 @@ void Recovery::compute_sums_linear(DOFVector<double> *uh, ElInfo *elInfo,
     ("SPR of flux or gradient need computing interior sums\n");
 
   WorldVector<double> node;     // For world coordinates at nodes.
-  const DegreeOfFreedom **dof = elInfo->getElement()->getDOF();
+  const DegreeOfFreedom **dof = elInfo->getElement()->getDof();
   ElementVector uh_loc(n_vertices);
   uh->getLocalVector(elInfo->getElement(), uh_loc);
 
@@ -440,7 +440,7 @@ void Recovery::compute_sums_linear(DOFVector<double> *uh, ElInfo *elInfo,
 
   if (vertex > 1 && elInfo->getNeighbour(vertex)) {
     int oppVertex = elInfo->getOppVertex(vertex);
-    DegreeOfFreedom k = elInfo->getNeighbour(vertex)->getDOF(oppVertex)[preDOFs[VERTEX]];
+    DegreeOfFreedom k = elInfo->getNeighbour(vertex)->getDof(oppVertex)[preDOFs[VERTEX]];
     
     if (rec_struct->neighbors->insert(k).second) {
       node = elInfo->getOppCoord(vertex);
@@ -510,7 +510,7 @@ void Recovery::fill_struct_vec(DOFVector<double> *uh,
   ElInfo *el_info = stack.traverseFirst(mesh, -1, fill_flag);
 
   while (el_info) {    // traversing the mesh.    
-    const DegreeOfFreedom **dof = el_info->getElement()->getDOF();
+    const DegreeOfFreedom **dof = el_info->getElement()->getDof();
     
     int n_neighbors = 0;     // counting interior vertices of element
     for (int i = 0; i < n_vertices; i++) {
@@ -893,7 +893,7 @@ Recovery::recovery(DOFVector<double> *uh,
 
   while (elInfo) {
     double det = elInfo->getDet();
-    const DegreeOfFreedom **dof = elInfo->getElement()->getDOF();
+    const DegreeOfFreedom **dof = elInfo->getElement()->getDof();
     uh->getLocalVector(elInfo->getElement(), localUh);
 
 
diff --git a/AMDiS/src/RefinementManager.cc b/AMDiS/src/RefinementManager.cc
index 133151addcf2ab14f9395c12a1f1cc2ab1c0af2c..7f3a6717e1c31fd80b1dc097b4cea3be2c855112 100644
--- a/AMDiS/src/RefinementManager.cc
+++ b/AMDiS/src/RefinementManager.cc
@@ -78,34 +78,35 @@ namespace AMDiS {
   }
 
 
-  void RefinementManager::refineElement(Mesh *aMesh, Element *el)
+  void RefinementManager::refineMacroElement(Mesh *aMesh, int macroElIndex)
   {
-    FUNCNAME("RefineManager::refineElement()");
+    FUNCNAME("RefineManager::refineMacroElement()");
     
     mesh = aMesh;
     int nElements = mesh->getNumberOfLeaves();
     newCoords = false;
-    doMoreRecursiveRefine = false;
+    doMoreRecursiveRefine = true;
     stack = new TraverseStack;
     
-    ElInfo *elInfo = 
-      stack->traverseFirst(mesh, -1, 
-			   Mesh::CALL_LEAF_EL | Mesh::FILL_NEIGH | Mesh::FILL_BOUND);
-    while (elInfo) {
-      if (elInfo->getElement() == el) {
-	refineFunction(elInfo);
-
-	TEST_EXIT(!doMoreRecursiveRefine)("Okay, this will not work in that way!\n");
-
-	break;
+    while (doMoreRecursiveRefine) {
+      doMoreRecursiveRefine = false;
+      ElInfo *elInfo = 
+	stack->traverseFirstOneMacro(mesh, macroElIndex, -1, 
+				     Mesh::CALL_LEAF_EL | Mesh::FILL_NEIGH | Mesh::FILL_BOUND);
+      
+      while (elInfo) {
+	if (elInfo->getElement()->getMark() > 0) {	  
+	  doMoreRecursiveRefine = 
+	    doMoreRecursiveRefine || (elInfo->getElement()->getMark() > 1);
+	  elInfo = refineFunction(elInfo);
+	}	
+	elInfo = stack->traverseNext(elInfo);
       }
-      elInfo = stack->traverseNext(elInfo);
     }
 
-#if 0
+
     if (newCoords)
-      setNewCoords(); // call of sub-class method      
-#endif
+      setNewCoords(); // call of sub-class method
 
     delete stack;
 
diff --git a/AMDiS/src/RefinementManager.h b/AMDiS/src/RefinementManager.h
index 5376545b00882c1fc6c4f0b9353a0e87df9ffc95..e7644bb48676e1e5c030cddb65b8438c55be4f99 100644
--- a/AMDiS/src/RefinementManager.h
+++ b/AMDiS/src/RefinementManager.h
@@ -66,7 +66,7 @@ namespace AMDiS {
      */
     virtual Flag refineMesh(Mesh *aMesh);
 
-    void refineElement(Mesh *amesh, Element *el);
+    void refineMacroElement(Mesh *amesh, int macroElIndex);
 
     /// All elements of the mesh will be refined.
     Flag globalRefine(Mesh *aMesh, int mark);
diff --git a/AMDiS/src/RefinementManager1d.cc b/AMDiS/src/RefinementManager1d.cc
index 5dff30b39b739e1eb734816938cf32f4ba5e0a94..5761302fcc027a09d7c7029d2ee8fe38d0799069 100644
--- a/AMDiS/src/RefinementManager1d.cc
+++ b/AMDiS/src/RefinementManager1d.cc
@@ -47,14 +47,14 @@ namespace AMDiS {
       doMoreRecursiveRefine = true;
 
     DegreeOfFreedom *newVertexDOFs = mesh->getDof(VERTEX);
-    child[0]->setDOF(1, newVertexDOFs);
-    child[1]->setDOF(0, newVertexDOFs);
+    child[0]->setDof(1, newVertexDOFs);
+    child[1]->setDof(0, newVertexDOFs);
 
     /*--------------------------------------------------------------------------*/
     /*  the other vertices are handed on from the parent                        */
     /*--------------------------------------------------------------------------*/
-    child[0]->setDOF(0, const_cast<int*>(el->getDOF(0)));
-    child[1]->setDOF(1, const_cast<int*>(el->getDOF(1)));
+    child[0]->setDof(0, const_cast<int*>(el->getDof(0)));
+    child[1]->setDof(1, const_cast<int*>(el->getDof(1)));
 
     /*--------------------------------------------------------------------------*/
     /*  there is one more leaf element, two hierachical elements,               */
@@ -69,8 +69,8 @@ namespace AMDiS {
       /*--------------------------------------------------------------------------*/
       /* there are dofs at the barycenter of the triangles                        */
       /*--------------------------------------------------------------------------*/
-      child[0]->setDOF(mesh->getNode(CENTER), const_cast<int*>(mesh->getDof(CENTER)));
-      child[1]->setDOF(mesh->getNode(CENTER), const_cast<int*>(mesh->getDof(CENTER)));
+      child[0]->setDof(mesh->getNode(CENTER), const_cast<int*>(mesh->getDof(CENTER)));
+      child[1]->setDof(mesh->getNode(CENTER), const_cast<int*>(mesh->getDof(CENTER)));
     }
 
     /*--------------------------------------------------------------------------*/
@@ -90,8 +90,8 @@ namespace AMDiS {
     }
 
     if (!mesh->queryCoarseDOFs() && mesh->getNumberOfDOFs(CENTER)) {
-      mesh->freeDof(const_cast<int*>( el->getDOF(mesh->getNode(CENTER))), CENTER);
-      el->setDOF(mesh->getNode(CENTER), NULL);
+      mesh->freeDof(const_cast<int*>( el->getDof(mesh->getNode(CENTER))), CENTER);
+      el->setDof(mesh->getNode(CENTER), NULL);
     }
   }
 
diff --git a/AMDiS/src/RefinementManager2d.cc b/AMDiS/src/RefinementManager2d.cc
index 2be22f5f09ff000e3d309180125d7540b1c7ea37..cf57ed17db3af561f1f49de0d65becdf07c1e1dc 100644
--- a/AMDiS/src/RefinementManager2d.cc
+++ b/AMDiS/src/RefinementManager2d.cc
@@ -20,17 +20,12 @@ namespace AMDiS {
   {
     FUNCNAME("RefinementManager::refineFunction()");
 
+    if (elInfo->getElement()->getMark() <= 0)
+      return elInfo;    
+
     bool bound = false;
     DegreeOfFreedom *edge[2];
     RCNeighbourList* refineList = new RCNeighbourList(2);
-
-    if (elInfo->getElement()->getMark() <= 0) {
-      delete refineList;
-
-      // Element may not be refined.
-      return elInfo;    
-    }
-
     refineList->setElement(0, elInfo->getElement());
     int n_neigh = 1;
 
@@ -40,12 +35,12 @@ namespace AMDiS {
   
     // === Give the refinement edge the right orientation. ===
 
-    if (elInfo->getElement()->getDOF(0, 0) < elInfo->getElement()->getDOF(1, 0)) {
-      edge[0] = const_cast<int*>(elInfo->getElement()->getDOF(0));
-      edge[1] = const_cast<int*>(elInfo->getElement()->getDOF(1));
+    if (elInfo->getElement()->getDof(0, 0) < elInfo->getElement()->getDof(1, 0)) {
+      edge[0] = const_cast<int*>(elInfo->getElement()->getDof(0));
+      edge[1] = const_cast<int*>(elInfo->getElement()->getDof(1));
     } else {
-      edge[1] = const_cast<int*>(elInfo->getElement()->getDOF(0));
-      edge[0] = const_cast<int*>(elInfo->getElement()->getDOF(1));
+      edge[1] = const_cast<int*>(elInfo->getElement()->getDof(0));
+      edge[0] = const_cast<int*>(elInfo->getElement()->getDof(1));
     }
 
     // === Get the refinement patch. ===
@@ -220,7 +215,7 @@ namespace AMDiS {
 	// === The only DOF that can be freed is that in the refinement edge; all ===
 	// === other DOFs are handed on the children.                             ===
 	
-	mesh->freeDof(const_cast<int*>(el->getDOF(node+2)), EDGE);
+	mesh->freeDof(const_cast<int*>(el->getDof(node+2)), EDGE);
       }
       if (mesh->getNumberOfDOFs(EDGE) || mesh->getNumberOfDOFs(CENTER))
 	refineList->removeDOFParents(n_neigh);
@@ -257,14 +252,14 @@ namespace AMDiS {
 
     // === Vertex 2 is the newest vertex. ===
 
-    child[0]->setDOF(2, newDOFs[0]);
-    child[1]->setDOF(2, newDOFs[0]);
+    child[0]->setDof(2, newDOFs[0]);
+    child[1]->setDof(2, newDOFs[0]);
 
     // === The other vertices are handed on from the parent. ===
 
     for (int i_child = 0; i_child < 2; i_child++) {
-      child[i_child]->setDOF(i_child, const_cast<int*>(el->getDOF(2)));
-      child[i_child]->setDOF(1 - i_child, const_cast<int*>(el->getDOF(i_child)));
+      child[i_child]->setDof(i_child, const_cast<int*>(el->getDof(2)));
+      child[i_child]->setDof(1 - i_child, const_cast<int*>(el->getDof(i_child)));
     }
 
     // === There is one more leaf element, two hierachical elements and one ===
@@ -278,24 +273,24 @@ namespace AMDiS {
       DegreeOfFreedom* newEdgeDOFs = mesh->getDof(EDGE);     
 
       // There are dofs in the midpoint of the edges.
-      child[0]->setDOF(4, newEdgeDOFs);
-      child[1]->setDOF(3, newEdgeDOFs);
+      child[0]->setDof(4, newEdgeDOFs);
+      child[1]->setDof(3, newEdgeDOFs);
       
       // Dofs handed on by the parent.
-      child[0]->setDOF(5, const_cast<int*>(el->getDOF(4)));
-      child[1]->setDOF(5, const_cast<int*>(el->getDOF(3)));
+      child[0]->setDof(5, const_cast<int*>(el->getDof(4)));
+      child[1]->setDof(5, const_cast<int*>(el->getDof(3)));
       
       // Dofs in the refinement edge.
-      child[0]->setDOF(3, newDOFs[1]);
-      child[1]->setDOF(4, newDOFs[2]);
+      child[0]->setDof(3, newDOFs[1]);
+      child[1]->setDof(4, newDOFs[2]);
     }
     
     if (mesh->getNumberOfDOFs(CENTER)) {
       int node = mesh->getNode(CENTER);
       
       // There are dofs at the barycenter of the triangles.
-      child[0]->setDOF(node, mesh->getDof(CENTER));
-      child[1]->setDOF(node, mesh->getDof(CENTER));
+      child[0]->setDof(node, mesh->getDof(CENTER));
+      child[1]->setDof(node, mesh->getDof(CENTER));
     }
   }
 
diff --git a/AMDiS/src/RefinementManager3d.cc b/AMDiS/src/RefinementManager3d.cc
index 1e07ef1c4ece55682ec14d65f2ba67cf45db94ae..1cb9c76b79883fd43790b60577311326be5cd929 100644
--- a/AMDiS/src/RefinementManager3d.cc
+++ b/AMDiS/src/RefinementManager3d.cc
@@ -47,14 +47,14 @@ namespace AMDiS {
       doMoreRecursiveRefine = true;
 
     int n_vertices = mesh->getGeo(VERTEX);
-    child[0]->setDOF(n_vertices - 1, dof[0]);
-    child[1]->setDOF(n_vertices - 1, dof[0]);
+    child[0]->setDof(n_vertices - 1, dof[0]);
+    child[1]->setDof(n_vertices - 1, dof[0]);
 
     for (int i = 0; i < n_vertices - 1; i++) {
       child[0]->
-	setDOF(i, const_cast<int*>(el->getDOF(Tetrahedron::childVertex[el_type][0][i])));
+	setDof(i, const_cast<int*>(el->getDof(Tetrahedron::childVertex[el_type][0][i])));
       child[1]->
-	setDOF(i, const_cast<int*>(el->getDOF(Tetrahedron::childVertex[el_type][1][i])));
+	setDof(i, const_cast<int*>(el->getDof(Tetrahedron::childVertex[el_type][1][i])));
     }
     /****************************************************************************/
     /*  there is one more leaf element and two more hierachical elements        */
@@ -76,34 +76,34 @@ namespace AMDiS {
       /****************************************************************************/
       
       child[0]->
-	setDOF(node, 
-	       const_cast<int*>(el->getDOF(node + Tetrahedron::childEdge[el_type][0][0])));
+	setDof(node, 
+	       const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][0][0])));
       child[1]->
-	setDOF(node, 
-	       const_cast<int*>(el->getDOF(node + Tetrahedron::childEdge[el_type][1][0])));
+	setDof(node, 
+	       const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][1][0])));
       child[0]->
-	setDOF(node + 1, 
-	       const_cast<int*>(el->getDOF(node + Tetrahedron::childEdge[el_type][0][1])));
+	setDof(node + 1, 
+	       const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][0][1])));
       child[1]->
-	setDOF(node + 1, 
-	       const_cast<int*>(el->getDOF(node + Tetrahedron::childEdge[el_type][1][1])));
+	setDof(node + 1, 
+	       const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][1][1])));
       child[0]->
-	setDOF(node + 3, 
-	       const_cast<int*>(el->getDOF(node + Tetrahedron::childEdge[el_type][0][3])));
+	setDof(node + 3, 
+	       const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][0][3])));
       child[1]->
-	setDOF(node + 3, 
-	       const_cast<int*>(el->getDOF(node + Tetrahedron::childEdge[el_type][1][3])));
+	setDof(node + 3, 
+	       const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][1][3])));
       
       /****************************************************************************/
       /*  adjust pointers to the dof's in the refinement edge                     */
       /****************************************************************************/
       
-      if (el->getDOF(0) == edge[0]) {
-	child[0]->setDOF(node + 2, dof[1]);
-	child[1]->setDOF(node + 2, dof[2]);
+      if (el->getDof(0) == edge[0]) {
+	child[0]->setDof(node + 2, dof[1]);
+	child[1]->setDof(node + 2, dof[2]);
       } else {
-	child[0]->setDOF(node + 2, dof[2]);
-	child[1]->setDOF(node + 2, dof[1]);
+	child[0]->setDof(node + 2, dof[2]);
+	child[1]->setDof(node + 2, dof[1]);
       }
     }
     
@@ -114,22 +114,22 @@ namespace AMDiS {
       /*  set pointers to those dof's that are handed on from the parant          */
       /****************************************************************************/
       
-      child[0]->setDOF(node + 3, const_cast<int*>(el->getDOF(node + 1)));
-      child[1]->setDOF(node + 3, const_cast<int*>(el->getDOF(node + 0)));
+      child[0]->setDof(node + 3, const_cast<int*>(el->getDof(node + 1)));
+      child[1]->setDof(node + 3, const_cast<int*>(el->getDof(node + 0)));
       
       /****************************************************************************/
       /*  get new dof for the common face of child0 and child1                    */
       /****************************************************************************/
       
       DegreeOfFreedom *newDOF = mesh->getDof(FACE);
-      child[0]->setDOF(node, static_cast<int*>(newDOF));
-      child[1]->setDOF(node, static_cast<int*>(newDOF));
+      child[0]->setDof(node, static_cast<int*>(newDOF));
+      child[1]->setDof(node, static_cast<int*>(newDOF));
     }
     
     if (mesh->getNumberOfDOFs(CENTER)) {
       int node = mesh->getNode(CENTER);
-      child[0]->setDOF(node, const_cast<int*>(mesh->getDof(CENTER)));
-      child[1]->setDOF(node, const_cast<int*>(mesh->getDof(CENTER)));
+      child[0]->setDof(node, const_cast<int*>(mesh->getDof(CENTER)));
+      child[1]->setDof(node, const_cast<int*>(mesh->getDof(CENTER)));
     }
 
     if (mesh->getNumberOfDOFs(EDGE) || mesh->getNumberOfDOFs(FACE))
@@ -168,14 +168,14 @@ namespace AMDiS {
 	  node0 += Tetrahedron::nChildEdge[el_type][0][dir];
 	  node1 += Tetrahedron::nChildEdge[el_type][1][dir];
 	  DegreeOfFreedom *newDOF = mesh->getDof(EDGE);
-	  (const_cast<Element*>(el->getFirstChild()))->setDOF(node0, newDOF);
-	  (const_cast<Element*>(el->getSecondChild()))->setDOF(node1, newDOF);
+	  (const_cast<Element*>(el->getFirstChild()))->setDof(node0, newDOF);
+	  (const_cast<Element*>(el->getSecondChild()))->setDof(node1, newDOF);
 	}
 	if (mesh->getNumberOfDOFs(FACE)) {
 	  node0 = mesh->getNode(FACE) + Tetrahedron::nChildFace[el_type][0][dir];
-	  (const_cast<Element*>(el->getFirstChild()))->setDOF(node0, mesh->getDof(FACE));
+	  (const_cast<Element*>(el->getFirstChild()))->setDof(node0, mesh->getDof(FACE));
 	  node1 = mesh->getNode(FACE) + Tetrahedron::nChildFace[el_type][1][dir];
-	  (const_cast<Element*>(el->getSecondChild()))->setDOF(node1, mesh->getDof(FACE));
+	  (const_cast<Element*>(el->getSecondChild()))->setDof(node1, mesh->getDof(FACE));
 	}
       } else {     /*   if (!neigh  ||  !neigh->child[0])                         */
 	/****************************************************************************/
@@ -183,7 +183,7 @@ namespace AMDiS {
 	/*  refinement edge                                                         */
 	/****************************************************************************/
       
-	if (el->getDOF(0) == neigh->getDOF(0)) {
+	if (el->getDof(0) == neigh->getDof(0)) {
 	  /****************************************************************************/
 	  /* same position at refinement edge                                         */
 	  /****************************************************************************/
@@ -210,23 +210,23 @@ namespace AMDiS {
 	    node0 = mesh->getNode(EDGE) + Tetrahedron::nChildEdge[el_type][i][dir];
 	    node1 = mesh->getNode(EDGE) + Tetrahedron::nChildEdge[n_type][j][oppVertex - 2];
 
-	    TEST_EXIT_DBG(neigh->getChild(j)->getDOF(node1))
+	    TEST_EXIT_DBG(neigh->getChild(j)->getDof(node1))
 	      ("no dof on neighbour %d at node %d\n", 
 	       neigh->getChild(j)->getIndex(), node1);
 
 	    (const_cast<Element*>(el->getChild(i)))->
-	      setDOF(node0, const_cast<int*>(neigh->getChild(j)->getDOF(node1)));
+	      setDof(node0, const_cast<int*>(neigh->getChild(j)->getDof(node1)));
 	  }
 	  if (mesh->getNumberOfDOFs(FACE)) {
 	    node0 = mesh->getNode(FACE) + i_neigh;
 	    node1 = mesh->getNode(FACE) + j_neigh;
 
-	    TEST_EXIT_DBG(neigh->getChild(j)->getDOF(node1))
+	    TEST_EXIT_DBG(neigh->getChild(j)->getDof(node1))
 	      ("No DOF on neighbour %d at node %d!\n",
 	       neigh->getChild(j)->getIndex(), node1);
 
 	    (const_cast<Element*>(el->getChild(i)))->
-	      setDOF(node0, const_cast<int*>(neigh->getChild(j)->getDOF(node1)));
+	      setDof(node0, const_cast<int*>(neigh->getChild(j)->getDof(node1)));
 	  }
 
 	}  /*   for (i = 0; i < 2; i++)                                       */
@@ -264,7 +264,7 @@ namespace AMDiS {
       int n_neigh = 1;
 
       for (int i = 0; i < 2; i++)
-	edge[i] = const_cast<int*>(el_info->getElement()->getDOF(i));
+	edge[i] = const_cast<int*>(el_info->getElement()->getDof(i));
 
       if (getRefinePatch(&elinfo, edge, 0, refList, &n_neigh)) {
 	// Domain's boundary was reached while looping around the refinement edge.
@@ -351,7 +351,7 @@ namespace AMDiS {
 	/****************************************************************************/
 
 	el = dynamic_cast<Tetrahedron*>(const_cast<Element*>(refineList->getElement(0)));
-	mesh->freeDof(const_cast<int*>(el->getDOF(mesh->getNode(EDGE))), EDGE);
+	mesh->freeDof(const_cast<int*>(el->getDof(mesh->getNode(EDGE))), EDGE);
       }
       
       if (mesh->getNumberOfDOFs(EDGE) || 
@@ -412,40 +412,40 @@ namespace AMDiS {
 
       int edgeDof0, edgeDof1;
       for (edgeDof0 = 0; edgeDof0 < vertices; edgeDof0++)
-	if (neigh->getDOF(edgeDof0) == edge[0])
+	if (neigh->getDof(edgeDof0) == edge[0])
 	  break;
       for (edgeDof1 = 0; edgeDof1 < vertices; edgeDof1++)
-	if (neigh->getDOF(edgeDof1) == edge[1])
+	if (neigh->getDof(edgeDof1) == edge[1])
 	  break;
 
       if (edgeDof0 > 3 || edgeDof1 > 3) {
 	for (edgeDof0 = 0; edgeDof0 < vertices; edgeDof0++)
-	  if (mesh->associated(neigh->getDOF(edgeDof0, 0), edge[0][0]))  
+	  if (mesh->associated(neigh->getDof(edgeDof0, 0), edge[0][0]))  
 	    break;
 	for (edgeDof1 = 0; edgeDof1 < vertices; edgeDof1++)
-	  if (mesh->associated(neigh->getDOF(edgeDof1, 0), edge[1][0]))  
+	  if (mesh->associated(neigh->getDof(edgeDof1, 0), edge[1][0]))  
 	    break;
 	    
 	if (edgeDof0 > 3 || edgeDof1 > 3) {
 	  for (edgeDof0 = 0; edgeDof0 < vertices; edgeDof0++)
-	    if (mesh->indirectlyAssociated(neigh->getDOF(edgeDof0, 0), edge[0][0]))  
+	    if (mesh->indirectlyAssociated(neigh->getDof(edgeDof0, 0), edge[0][0]))  
 	      break;
 	  for (edgeDof1 = 0; edgeDof1 < vertices; edgeDof1++)
-	    if (mesh->indirectlyAssociated(neigh->getDOF(edgeDof1, 0), edge[1][0]))  
+	    if (mesh->indirectlyAssociated(neigh->getDof(edgeDof1, 0), edge[1][0]))  
 	      break;
 	    
 	  TEST_EXIT_DBG(edgeDof0 < vertices && edgeDof1 < vertices)
  	    ("dof %d or dof %d not found on element %d with nodes (%d %d %d %d)\n", 
- 	     edge[0][0], edge[1][0], neigh->getIndex(), neigh->getDOF(0,0),
- 	     neigh->getDOF(1, 0), neigh->getDOF(2, 0), neigh->getDOF(3, 0));
+ 	     edge[0][0], edge[1][0], neigh->getIndex(), neigh->getDof(0,0),
+ 	     neigh->getDof(1, 0), neigh->getDof(2, 0), neigh->getDof(3, 0));
 
 	}
       }
 
       TEST_EXIT_DBG(edgeDof0 < vertices && edgeDof1 < vertices)
 	("dof %d or dof %d not found on element %d with nodes (%d %d %d %d)\n", 
-	 edge[0][0], edge[1][0], neigh->getIndex(), neigh->getDOF(0, 0),
-	 neigh->getDOF(1, 0), neigh->getDOF(2, 0), neigh->getDOF(3, 0));
+	 edge[0][0], edge[1][0], neigh->getIndex(), neigh->getDof(0, 0),
+	 neigh->getDof(1, 0), neigh->getDof(2, 0), neigh->getDof(3, 0));
 
       int edgeNo = Tetrahedron::edgeOfDofs[edgeDof0][edgeDof1];
 
@@ -574,10 +574,10 @@ namespace AMDiS {
 
       int edgeDof0, edgeDof1;
       for (edgeDof0 = 0; edgeDof0 < vertices; edgeDof0++)
-	if (neigh->getDOF(edgeDof0) == edge[0])
+	if (neigh->getDof(edgeDof0) == edge[0])
 	  break;
       for (edgeDof1 = 0; edgeDof1 < vertices; edgeDof1++)
-	if (neigh->getDOF(edgeDof1) == edge[1])
+	if (neigh->getDof(edgeDof1) == edge[1])
 	  break;
 
       TEST_EXIT_DBG(neighInfo->getElement()->getIndex() == testIndex)
@@ -594,12 +594,12 @@ namespace AMDiS {
   {
     FUNCNAME("RefinementManager3d::refineFunction()");
 
+    if (el_info->getElement()->getMark() <= 0)  
+      return el_info;
+
     int bound = false;
     DegreeOfFreedom *edge[2];
 
-    if (el_info->getElement()->getMark() <= 0)  
-      return el_info;    // element may not be refined 
-
     // === Get memory for a list of all elements at the refinement edge. ===
 
     RCNeighbourList *ref_list = new RCNeighbourList(mesh->getMaxEdgeNeigh());
@@ -614,12 +614,12 @@ namespace AMDiS {
 
     // === Give the refinement edge the right orientation. ===
 
-    if (el_info->getElement()->getDOF(0, 0) < el_info->getElement()->getDOF(1, 0)) {
-      edge[0] = const_cast<DegreeOfFreedom*>(el_info->getElement()->getDOF(0));
-      edge[1] = const_cast<DegreeOfFreedom*>(el_info->getElement()->getDOF(1));
+    if (el_info->getElement()->getDof(0, 0) < el_info->getElement()->getDof(1, 0)) {
+      edge[0] = const_cast<DegreeOfFreedom*>(el_info->getElement()->getDof(0));
+      edge[1] = const_cast<DegreeOfFreedom*>(el_info->getElement()->getDof(1));
     } else {
-      edge[1] = const_cast<DegreeOfFreedom*>(el_info->getElement()->getDOF(0));
-      edge[0] = const_cast<DegreeOfFreedom*>(el_info->getElement()->getDOF(1));
+      edge[1] = const_cast<DegreeOfFreedom*>(el_info->getElement()->getDof(0));
+      edge[0] = const_cast<DegreeOfFreedom*>(el_info->getElement()->getDof(1));
     }
 
 
diff --git a/AMDiS/src/TecPlotWriter.cc b/AMDiS/src/TecPlotWriter.cc
index 156d92e1f7dbe384f76386f1108c8b0fe35f40ff..e0535934f7281ab149afc61a394a26e1119234ed 100644
--- a/AMDiS/src/TecPlotWriter.cc
+++ b/AMDiS/src/TecPlotWriter.cc
@@ -9,7 +9,7 @@ namespace AMDiS {
   {
     const DOFAdmin* admin = values->getFeSpace()->getAdmin(); 
     int n0 = admin->getNumberOfPreDOFs(VERTEX);
-    const DegreeOfFreedom **dof = elinfo->getElement()->getDOF();
+    const DegreeOfFreedom **dof = elinfo->getElement()->getDof();
   
     int dim = elinfo->getMesh()->getDim();
     int dow = Global::getGeo(WORLD);
@@ -49,7 +49,7 @@ namespace AMDiS {
   {
     const DOFAdmin* admin = values->getDOFVector(0)->getFeSpace()->getAdmin(); 
     int n0 = admin->getNumberOfPreDOFs(VERTEX);
-    const DegreeOfFreedom **dof = elinfo->getElement()->getDOF();
+    const DegreeOfFreedom **dof = elinfo->getElement()->getDof();
   
     int dim = elinfo->getMesh()->getDim();
     int dow = Global::getGeo(WORLD);
diff --git a/AMDiS/src/TecPlotWriter.hh b/AMDiS/src/TecPlotWriter.hh
index 5b09cfedc64ac7875d313483a19a778cf98ccf9d..49d1df1e5feb3d05cfe5521ecfc7dc1bc3339791 100644
--- a/AMDiS/src/TecPlotWriter.hh
+++ b/AMDiS/src/TecPlotWriter.hh
@@ -23,7 +23,7 @@ namespace AMDiS {
   {
     const DOFAdmin* admin = values->getFeSpace()->getAdmin(); 
     int n0 = admin->getNumberOfPreDOFs(VERTEX);
-    const DegreeOfFreedom **dof = elinfo->getElement()->getDOF();
+    const DegreeOfFreedom **dof = elinfo->getElement()->getDof();
 
     int dim = elinfo->getMesh()->getDim();
     //  int dow = Global::getGeo(WORLD);
diff --git a/AMDiS/src/Tetrahedron.cc b/AMDiS/src/Tetrahedron.cc
index 8157c120ee11afc30c1ffb4b4e64ab36771985cb..87d48feab8f6f08da94a6bf5b2ec257c45669545 100644
--- a/AMDiS/src/Tetrahedron.cc
+++ b/AMDiS/src/Tetrahedron.cc
@@ -256,14 +256,14 @@ namespace AMDiS {
 	  child[1]->getVertexDofs(feSpace, nextBound1, dofs);
 	  
 	  if (addDof)
-	    dofs.push_back(child[0]->getDOF(3));
+	    dofs.push_back(child[0]->getDof(3));
 	  
 	  child[0]->getVertexDofs(feSpace, nextBound0, dofs);
 	} else {
 	  child[0]->getVertexDofs(feSpace, nextBound0, dofs);
 	  
 	  if (addDof)
-	    dofs.push_back(child[0]->getDOF(3));
+	    dofs.push_back(child[0]->getDof(3));
 	  
 	  child[1]->getVertexDofs(feSpace, nextBound1, dofs);	  
 	}
@@ -295,11 +295,11 @@ namespace AMDiS {
 
       if (bound.reverseMode) {
 	child[1]->getVertexDofs(feSpace, nextBound0, dofs);
-	dofs.push_back(child[0]->getDOF(3));
+	dofs.push_back(child[0]->getDof(3));
 	child[0]->getVertexDofs(feSpace, nextBound1, dofs);
       } else {
 	child[0]->getVertexDofs(feSpace, nextBound0, dofs);
-	dofs.push_back(child[0]->getDOF(3));
+	dofs.push_back(child[0]->getDof(3));
 	child[1]->getVertexDofs(feSpace, nextBound1, dofs);
       }
 
diff --git a/AMDiS/src/Traverse.cc b/AMDiS/src/Traverse.cc
index a67c3afce57ead3669a598a855c7bcb721186f75..60937dd97d73e3c90f6f11a67203ca8c1c7a5c98 100644
--- a/AMDiS/src/Traverse.cc
+++ b/AMDiS/src/Traverse.cc
@@ -672,14 +672,14 @@ namespace AMDiS {
 	TEST_EXIT_DBG(el->getChild(0))("invalid new refinement?\n");
 
 	int i = 0;
-	if (el->getDOF(0) == el2->getDOF(0))
+	if (el->getDof(0) == el2->getDof(0))
 	  i = save_info_stack[stack2_used] - 1;
-	else if (el->getDOF(1) == el2->getDOF(0))
+	else if (el->getDof(1) == el2->getDof(0))
 	  i = 2 - save_info_stack[stack2_used];
 	else {
-	  if (traverse_mesh->associated(el->getDOF(0, 0), el2->getDOF(0, 0)))
+	  if (traverse_mesh->associated(el->getDof(0, 0), el2->getDof(0, 0)))
 	    i = save_info_stack[stack2_used] - 1;
-	  else if (traverse_mesh->associated(el->getDOF(1, 0), el2->getDOF(0, 0)))
+	  else if (traverse_mesh->associated(el->getDof(1, 0), el2->getDof(0, 0)))
 	    i = 2 - save_info_stack[stack2_used];
 	  else {
 	    ERROR_EXIT("No common refinement edge! %d\n", traverse_fill_flag.isSet(Mesh::CALL_REVERSE_MODE));
@@ -691,8 +691,8 @@ namespace AMDiS {
  	  testChild = 1 - testChild;
 
 	if (el->getChild(0) &&  
-	    (el->getChild(testChild)->getDOF(1) == el->getDOF(nb) ||
-	     traverse_mesh->associated(el->getChild(testChild)->getDOF(1, 0), el->getDOF(nb, 0))))
+	    (el->getChild(testChild)->getDof(1) == el->getDof(nb) ||
+	     traverse_mesh->associated(el->getChild(testChild)->getDof(1, 0), el->getDof(nb, 0))))
 	  nb = 1;	
 	else
 	  nb = 2;	
@@ -718,10 +718,10 @@ namespace AMDiS {
 	el2 = elinfo2->getElement();
 
 	if (save_stack_used > stack2_used) {
-	  const DegreeOfFreedom *dof = el2->getDOF(1);
-	  if (dof != el->getDOF(1) && dof != el->getDOF(2) &&
-	      !traverse_mesh->associated(dof[0], el->getDOF(1, 0)) &&
-	      !traverse_mesh->associated(dof[0], el->getDOF(2, 0))) {
+	  const DegreeOfFreedom *dof = el2->getDof(1);
+	  if (dof != el->getDof(1) && dof != el->getDof(2) &&
+	      !traverse_mesh->associated(dof[0], el->getDof(1, 0)) &&
+	      !traverse_mesh->associated(dof[0], el->getDof(2, 0))) {
 	  
 	    stack2_used++;               /* go down one level in OLD hierarchy */
 	    elinfo2 = save_elinfo_stack[stack2_used];
diff --git a/AMDiS/src/Triangle.cc b/AMDiS/src/Triangle.cc
index 991f192952e428b8f96dc0e3bae34b1d847cf919..671d66a22fbba0563202212d926421ec70278ec6 100644
--- a/AMDiS/src/Triangle.cc
+++ b/AMDiS/src/Triangle.cc
@@ -97,13 +97,13 @@ namespace AMDiS {
  	  if (bound.reverseMode) {
  	    nextBound.ithObj = 1;
  	    child[1]->getSecondChild()->getVertexDofs(feSpace, nextBound, dofs);
- 	    dofs.push_back(child[1]->getFirstChild()->getDOF(2));	    
+ 	    dofs.push_back(child[1]->getFirstChild()->getDof(2));	    
  	    nextBound.ithObj = 0;
  	    child[1]->getFirstChild()->getVertexDofs(feSpace, nextBound, dofs);	    
  	  } else {
 	    nextBound.ithObj = 0;
 	    child[1]->getFirstChild()->getVertexDofs(feSpace, nextBound, dofs);	    
-	    dofs.push_back(child[1]->getFirstChild()->getDOF(2));	    
+	    dofs.push_back(child[1]->getFirstChild()->getDof(2));	    
 	    nextBound.ithObj = 1;
 	    child[1]->getSecondChild()->getVertexDofs(feSpace, nextBound, dofs);
 	  }
@@ -116,13 +116,13 @@ namespace AMDiS {
 	  if (bound.reverseMode) {
 	    nextBound.ithObj = 1;
 	    child[0]->getSecondChild()->getVertexDofs(feSpace, nextBound, dofs);
-	    dofs.push_back(child[0]->getFirstChild()->getDOF(2));
+	    dofs.push_back(child[0]->getFirstChild()->getDof(2));
 	    nextBound.ithObj = 0;
 	    child[0]->getFirstChild()->getVertexDofs(feSpace, nextBound, dofs);
 	  } else {
 	    nextBound.ithObj = 0;
 	    child[0]->getFirstChild()->getVertexDofs(feSpace, nextBound, dofs);
-	    dofs.push_back(child[0]->getFirstChild()->getDOF(2));
+	    dofs.push_back(child[0]->getFirstChild()->getDof(2));
 	    nextBound.ithObj = 1;
 	    child[0]->getSecondChild()->getVertexDofs(feSpace, nextBound, dofs);
 	  }
@@ -134,13 +134,13 @@ namespace AMDiS {
 	if (bound.reverseMode) {
 	  nextBound.ithObj = 1;
 	  child[1]->getVertexDofs(feSpace, nextBound, dofs);
-	  dofs.push_back(child[0]->getDOF(2));	  
+	  dofs.push_back(child[0]->getDof(2));	  
 	  nextBound.ithObj = 0;
 	  child[0]->getVertexDofs(feSpace, nextBound, dofs);
 	} else {
 	  nextBound.ithObj = 0;
 	  child[0]->getVertexDofs(feSpace, nextBound, dofs);	  
-	  dofs.push_back(child[0]->getDOF(2));	  
+	  dofs.push_back(child[0]->getDof(2));	  
 	  nextBound.ithObj = 1;
 	  child[1]->getVertexDofs(feSpace, nextBound, dofs);
 	}
diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc
index c0d78f4ac4f797e30dd987e8a36f370f6b4d604b..7ac831b64e809d7c7385b3cdd982c6c949262cc9 100644
--- a/AMDiS/src/parallel/MeshDistributor.cc
+++ b/AMDiS/src/parallel/MeshDistributor.cc
@@ -1,9 +1,10 @@
 #include <algorithm>
 #include <iostream>
 #include <fstream>
+#include <limits>
+#include <stdint.h>
 #include <boost/lexical_cast.hpp>
 #include <boost/filesystem.hpp>
-#include <limits>
 
 #include "parallel/MeshDistributor.h"
 #include "parallel/ParallelDebug.h"
@@ -27,6 +28,7 @@
 #include "ProblemVec.h"
 #include "ProblemInstat.h"
 #include "Debug.h"
+#include "MacroInfo.h"
 
 namespace AMDiS {
 
@@ -47,7 +49,6 @@ namespace AMDiS {
       refineManager(NULL),
       info(10),
       partitioner(NULL),
-      initialPartitionMesh(true),
       nRankDofs(0),
       nOverallDofs(0),
       rstart(0),
@@ -90,12 +91,21 @@ namespace AMDiS {
     // in some way.
     testForMacroMesh();
 
+    // For later mesh repartitioning, we need to store some information about the
+    // macro mesh.
+    createMacroElementInfo();
+
     // create an initial partitioning of the mesh
     partitioner->createPartitionData();
+
     // set the element weights, which are 1 at the very first begin
     setInitialElementWeights();
-    // and now partition the mesh
-    partitionMesh();   
+
+    // and now partition the mesh    
+    partitioner->fillCoarsePartitionVec(&oldPartitionVec);
+    partitioner->partition(&elemWeights, INITIAL);
+    partitioner->fillCoarsePartitionVec(&partitionVec);
+
 
 #if (DEBUG != 0)
     debug::ElementIdxToDofs elMap;
@@ -581,7 +591,7 @@ namespace AMDiS {
     StdMpi<MeshCodeVec> stdMpi(mpiComm, true);
     stdMpi.send(sendCodes);
     stdMpi.recv(allBound);
-    stdMpi.startCommunication<unsigned long int>(MPI_UNSIGNED_LONG);
+    stdMpi.startCommunication<uint64_t>(MPI_UNSIGNED_LONG);
  
     // === Compare received mesh structure codes. ===
     
@@ -609,7 +619,7 @@ namespace AMDiS {
 					     boundIt->rankObj.reverseMode);
 
 	  if (b)
-	    meshFitTogether = false;
+	    meshFitTogether = false;	  
  	}
 
 	i++;
@@ -933,23 +943,6 @@ namespace AMDiS {
   }
 
 
-  void MeshDistributor::partitionMesh()
-  {
-    FUNCNAME("MeshDistributor::partitionMesh()");
-
-    if (initialPartitionMesh) {
-      initialPartitionMesh = false;
-      partitioner->fillCoarsePartitionVec(&oldPartitionVec);
-      partitioner->partition(&elemWeights, INITIAL);
-    } else {
-      oldPartitionVec = partitionVec;
-      partitioner->partition(&elemWeights, ADAPTIVE_REPART, 1000.0);
-    }    
-
-    partitioner->fillCoarsePartitionVec(&partitionVec);
-  }
-
-
   void MeshDistributor::repartitionMesh()
   {
     FUNCNAME("MeshDistributor::repartitionMesh()");
@@ -1000,13 +993,239 @@ namespace AMDiS {
     }
 
     partitioner->useLocalGlobalDofMap(&mapLocalGlobalDofs);
-    partitionMesh();
+    oldPartitionVec = partitionVec;
+    partitioner->partition(&elemWeights, ADAPTIVE_REPART, 1000.0);    
+
+    MacroInfo* minfo = mesh->getMacroFileInfo();
+    TEST_EXIT_DBG(minfo)("No macro file info!\n");
+
+
+    // === Create map that maps macro element indices to pointers to the ===
+    // === macro elements.                                               ===
+
+    std::map<int, MacroElement*> elIndexMap;
+    for (std::deque<MacroElement*>::iterator it = minfo->mel.begin();
+	 it != minfo->mel.end(); ++it)
+      elIndexMap[(*it)->getIndex()] = *it;
+
+    
+    // === Craete set of all new macro elements this rank will receive from ===
+    // === other ranks.                                                     ===
+
+    std::set<MacroElement*> newMacroEl;
+    for (std::map<int, std::vector<int> >::iterator it = partitioner->getRecvElements().begin();
+	 it != partitioner->getRecvElements().end(); ++it) {
+      for (std::vector<int>::iterator elIt = it->second.begin();
+	   elIt != it->second.end(); ++elIt) {
+	TEST_EXIT_DBG(elIndexMap.count(*elIt) == 1)
+	  ("Could not find macro element %d\n", *elIt);
+	newMacroEl.insert(elIndexMap[*elIt]);
+      }
+    }
+
+    std::set<MacroElement*> allMacroEl = newMacroEl;
+    for (std::deque<MacroElement*>::iterator it = mesh->firstMacroElement();
+	 it != mesh->endOfMacroElements(); ++it)
+      allMacroEl.insert(*it);
+
+
+    // === Add new macro elements to mesh. ===
+
+    while (!newMacroEl.empty()) {
+      MacroElement *mel = *(newMacroEl.begin());
+      MSG("NEW MACRO EL: %d\n", mel->getIndex());
+
+      for (int i = 0; i < mesh->getGeo(NEIGH); i++)
+	mel->setNeighbour(i, NULL);
+
+      for (int i = 0; i < mesh->getGeo(VERTEX); i++)
+	mel->getElement()->setDof(i, mesh->getDof(VERTEX));
+
+      mesh->getMacroElements().push_back(mel);
+      newMacroEl.erase(newMacroEl.begin());
+    }
+
+
+    // === Send and receive mesh structure codes. ===
+
+    std::map<int, MeshCodeVec> sendCodes;
+    for (std::map<int, std::vector<int> >::iterator it = partitioner->getSendElements().begin();
+	 it != partitioner->getSendElements().end(); ++it) {
+      for (std::vector<int>::iterator elIt = it->second.begin();
+	   elIt != it->second.end(); ++elIt) {
+	MSG("MAKE EL-STRUC FOR EL %d TO RANK %d\n", *elIt, it->first);
+	MeshStructure elCode;
+	elCode.init(mesh, *elIt);
+	sendCodes[it->first].push_back(elCode);
+      }
+    }
+
+    StdMpi<MeshCodeVec> stdMpi(mpiComm, true);
+    stdMpi.send(sendCodes);
+    stdMpi.recv(partitioner->getRecvElements());
+    stdMpi.startCommunication<uint64_t>(MPI_UNSIGNED_LONG);
+
+
+    // === Adapte the new macro elements due to the received mesh structure codes. ===
+
+    for (std::map<int, std::vector<int> >::iterator it = partitioner->getRecvElements().begin();
+	 it != partitioner->getRecvElements().end(); ++it) {
+      MeshCodeVec &recvCodes = stdMpi.getRecvData()[it->first];
+      int i = 0;
+
+      TEST_EXIT_DBG(recvCodes.size() == it->second.size())
+	("Should not happen!\n");
+
+      for (std::vector<int>::iterator elIt = it->second.begin();
+	   elIt != it->second.end(); ++elIt) {
+	MSG("RECV EL-STRUC FOR EL %d FROM RANK %d\n", *elIt, it->first);
+
+	recvCodes[i++].fitMeshToStructure(mesh, refineManager, false, *elIt);
+      }
+    }
+
+    MSG("DAS IST FERTIG!\n");
+
+    
+
+    // === Set correct neighbour information on macro elements. ===
+
+    for (std::set<MacroElement*>::iterator it = allMacroEl.begin();
+	 it != allMacroEl.end(); ++it) {
+      int elIndex = (*it)->getIndex();
+      for (int i = 0; i < mesh->getGeo(NEIGH); i++) {
+	int neighIndex = macroElementNeighbours[elIndex][i];
+	if (neighIndex == -1 || 
+	    partitioner->getElementInRank()[neighIndex] == false)
+	  (*it)->setNeighbour(i, NULL);
+	else
+	  (*it)->setNeighbour(i, elIndexMap[neighIndex]);
+      }
+    }
+
+
+    // === Delete macros from mesh. ===
+
+    std::set<MacroElement*> deleteMacroElements;
+
+    for (std::map<int, std::vector<int> >::iterator it = partitioner->getSendElements().begin();
+	 it != partitioner->getSendElements().end(); ++it) {
+      for (std::vector<int>::iterator elIt = it->second.begin();
+	   elIt != it->second.end(); ++elIt) {
+	TEST_EXIT_DBG(elIndexMap.count(*elIt) == 1)
+	  ("Could not find macro element %d\n", *elIt);
+	MSG("DELETE MACRO %d\n", (*elIt));
+	deleteMacroElements.insert(elIndexMap[*elIt]);
+      }
+    }
+
+    MSG("REMOVE MACRO ELEMENT!\n");
+    
+    mesh->removeMacroElements(deleteMacroElements, feSpace);
+
+
+    // === Remove double DOFs. ===
+
+    std::map<int, int> leafInMacroEl;
+
+    elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
+    while (elInfo) {
+      leafInMacroEl[elInfo->getElement()->getIndex()] = 
+	elInfo->getMacroElement()->getIndex();
+      elInfo = stack.traverseNext(elInfo);
+    }
+
+    std::map<const DegreeOfFreedom*, const DegreeOfFreedom*> mapDelDofs;
+
+    elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL | Mesh::FILL_NEIGH);
+    while (elInfo) {
+      Element *el = elInfo->getElement();
+
+      for (int i = 0; i < mesh->getGeo(NEIGH); i++) {
+	if (!elInfo->getNeighbour(i))
+	  continue;
+
+	if (leafInMacroEl[el->getIndex()] != 
+	    leafInMacroEl[elInfo->getNeighbour(i)->getIndex()]) {
+	  Element *neigh = elInfo->getNeighbour(i);
+	  int elEdgeIndex = i;
+	  int neighEdgeIndex = elInfo->getOppVertex(i);
+
+	  DofEdge elEdge = el->getEdge(elEdgeIndex);
+	  DofEdge neighEdge = neigh->getEdge(neighEdgeIndex);	  
+
+	  if (elEdge != neighEdge) {
+	    int elEdgeIndex0 = el->getVertexOfEdge(elEdgeIndex, 0);
+	    int elEdgeIndex1 = el->getVertexOfEdge(elEdgeIndex, 1);
+
+	    int neighEdgeIndex0 = neigh->getVertexOfEdge(neighEdgeIndex, 0);
+	    int neighEdgeIndex1 = neigh->getVertexOfEdge(neighEdgeIndex, 1);
+
+	    DegreeOfFreedom elEdgeDof0 = el->getDof(elEdgeIndex0, 0);
+	    DegreeOfFreedom elEdgeDof1 = el->getDof(elEdgeIndex1, 0);
+
+	    DegreeOfFreedom neighEdgeDof0 = neigh->getDof(neighEdgeIndex0, 0);
+	    DegreeOfFreedom neighEdgeDof1 = neigh->getDof(neighEdgeIndex1, 0);
+
+	    if ((elEdgeDof0 < elEdgeDof1 && neighEdgeDof0 > neighEdgeDof1) ||
+		(elEdgeDof0 > elEdgeDof1 && neighEdgeDof0 < neighEdgeDof1)) {
+	      std::swap(neighEdgeIndex0, neighEdgeIndex1);
+	      std::swap(neighEdgeDof0, neighEdgeDof1);
+	    }
+
+	    if (neighEdgeDof0 != elEdgeDof0)
+	      mapDelDofs[neigh->getDof(neighEdgeIndex0)] = el->getDof(elEdgeIndex0);
+
+	    if (neighEdgeDof1 != elEdgeDof1)
+	      mapDelDofs[neigh->getDof(neighEdgeIndex1)] = el->getDof(elEdgeIndex1);
+	  }
+	}
+      }
+
+      elInfo = stack.traverseNext(elInfo);
+    }
+
+
+    elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
+    while (elInfo) {
+      for (int i = 0; i < mesh->getGeo(VERTEX); i++)
+	if (mapDelDofs.count(elInfo->getElement()->getDof(i)) == 1) {
+	  MSG("SET DOF %d TO DOF %d in EL %d\n",
+	      elInfo->getElement()->getDof(i, 0),
+	      *(mapDelDofs[elInfo->getElement()->getDof(i)]),
+	      elInfo->getElement()->getIndex());
+
+	  elInfo->getElement()->setDof(i, const_cast<DegreeOfFreedom*>(mapDelDofs[elInfo->getElement()->getDof(i)]));
+	}
+
+      elInfo = stack.traverseNext(elInfo);
+    }
+
+    for (std::map<const DegreeOfFreedom*, const DegreeOfFreedom*>::iterator it = mapDelDofs.begin();
+	 it != mapDelDofs.end(); ++it) {
+      MSG("DOF TO DEL: %d\n", (*(it->first)));
+
+      mesh->freeDof(const_cast<DegreeOfFreedom*>(it->first), VERTEX);
+    }
+
+    MSG("WRITE OUTPUT\n");
+
+    DOFVector<double> tmp(feSpace, "tmp");
+    tmp.set(mpiRank);
+    // stringstream oss;
+    // oss << "repartion-" << mpiRank << ".vtu";
+    VtkWriter::writeFile(tmp, "repartition-.vtu");
+
+
+    MSG("DONE!\n");
+
+    exit(0);
 
 #if (DEBUG != 0)
     ParallelDebug::testAllElements(*this);
 #endif
 
-    MSG("DONE\n");
+    partitioner->fillCoarsePartitionVec(&partitionVec);
   }
 
 
@@ -1149,7 +1368,7 @@ namespace AMDiS {
       // === Add all sub object of the element to the variable elObjects. ===
 
       for (int i = 0; i < el->getGeo(VERTEX); i++)
-	elObjects.addVertex(el->getDOF(i, 0), el->getIndex(), i);
+	elObjects.addVertex(el->getDof(i, 0), el->getIndex(), i);
 
       for (int i = 0; i < el->getGeo(EDGE); i++)
 	elObjects.addEdge(el->getEdge(i), el->getIndex(), i);      
@@ -1173,14 +1392,14 @@ namespace AMDiS {
 
 	    for (int j = 0; j < 2; j++) {
 	      int ithDofRankObj = el->getVertexOfEdge(i, j);
-	      DegreeOfFreedom dof = el->getDOF(ithDofRankObj, 0);
+	      DegreeOfFreedom dof = el->getDof(ithDofRankObj, 0);
 
 	      DegreeOfFreedom neighDof = -1;	  
 	      int ithDofNeighObj = -1;	  
 	      for (int k = 0; k < 3; k++) {
-		if (elInfo->getNeighbour(i)->getDOF(k, 0) == 
+		if (elInfo->getNeighbour(i)->getDof(k, 0) == 
 		    mesh->getPeriodicAssociations(boundaryType)[dof]) {
-		  neighDof = elInfo->getNeighbour(i)->getDOF(k, 0);
+		  neighDof = elInfo->getNeighbour(i)->getDof(k, 0);
 		  ithDofNeighObj = k;
 		  break;
 		}
@@ -1414,8 +1633,7 @@ namespace AMDiS {
 
     std::set<MacroElement*> macrosToRemove;
     for (std::deque<MacroElement*>::iterator it = mesh->firstMacroElement();
-	 it != mesh->endOfMacroElements();
-	 ++it)
+	 it != mesh->endOfMacroElements(); ++it)
       if (partitioner->getElementInRank()[(*it)->getIndex()] == false)
 	macrosToRemove.insert(*it);    
 
@@ -1995,10 +2213,23 @@ namespace AMDiS {
   }
 
 
+  void MeshDistributor::createMacroElementInfo()
+  {
+    FUNCNAME("MeshDistributor::createMacroElementInfo()");
+
+    for (std::deque<MacroElement*>::iterator it = mesh->firstMacroElement();
+	 it != mesh->endOfMacroElements(); ++it) {
+      macroElementNeighbours[(*it)->getIndex()].resize(mesh->getGeo(NEIGH));
+      for (int i = 0; i < mesh->getGeo(NEIGH); i++)
+	macroElementNeighbours[(*it)->getIndex()][i] = 
+	  (*it)->getNeighbour(i) ? (*it)->getNeighbour(i)->getIndex() : -1;
+    }     
+  }
+
+
   void MeshDistributor::serialize(std::ostream &out)
   {
     SerUtil::serialize(out, elemWeights);
-    SerUtil::serialize(out, initialPartitionMesh);
     SerUtil::serialize(out, partitionVec);
     SerUtil::serialize(out, oldPartitionVec);
     SerUtil::serialize(out, nRankDofs);
@@ -2028,7 +2259,6 @@ namespace AMDiS {
     FUNCNAME("MeshDistributor::deserialize()");
 
     SerUtil::deserialize(in, elemWeights);
-    SerUtil::deserialize(in, initialPartitionMesh);
     SerUtil::deserialize(in, partitionVec);
     SerUtil::deserialize(in, oldPartitionVec);
     SerUtil::deserialize(in, nRankDofs);    
diff --git a/AMDiS/src/parallel/MeshDistributor.h b/AMDiS/src/parallel/MeshDistributor.h
index 5719ae74ea3821f3c35cb22415ca232be4864c2f..e3007237d95f5a1e7fd6428f8adf6342e83c1e81 100644
--- a/AMDiS/src/parallel/MeshDistributor.h
+++ b/AMDiS/src/parallel/MeshDistributor.h
@@ -107,9 +107,6 @@ namespace AMDiS {
     /// Set for each element on the partitioning level the number of leaf elements.
     void setInitialElementWeights();
 
-    /// Creates a partitioning of the mesh for a given weights of the macro elements.
-    void partitionMesh();
-
     /** \brief
      * Checks if is required to repartition the mesh. If this is the case, a new
      * partition will be created and the mesh will be redistributed between the
@@ -268,6 +265,8 @@ namespace AMDiS {
      */
     void createPeriodicMap();
 
+    void createMacroElementInfo();
+
     /** \brief
      * This function create new mappings from local to global indices, 
      * \ref mapLocalGlobalDofs, and from local to dof indices, \ref mapLocalDofIndex.
@@ -481,9 +480,6 @@ namespace AMDiS {
     /// Weights for the elements, i.e., the number of leaf elements within this element.
     std::map<int, double> elemWeights;
 
-    /// Is true, if the mesh was not partitioned before, otherwise it's false.
-    bool initialPartitionMesh;
-
     /** \brief
      * Stores to every coarse element index the number of the partition it 
      * corresponds to.
@@ -591,6 +587,8 @@ namespace AMDiS {
     /// may not be the case.
     bool macroElementStructureConsisten;
 
+    std::map<int, std::vector<int> > macroElementNeighbours;
+
     friend class ParallelDebug;
   };
 }
diff --git a/AMDiS/src/parallel/ParMetisPartitioner.cc b/AMDiS/src/parallel/ParMetisPartitioner.cc
index b92f65709c8feb2ab43316032d6ef8f80eac9736..30332bbda8ce9ba0cfbfd2d863e5e45e6013919a 100644
--- a/AMDiS/src/parallel/ParMetisPartitioner.cc
+++ b/AMDiS/src/parallel/ParMetisPartitioner.cc
@@ -86,9 +86,9 @@ namespace AMDiS {
 	// write eind entries (element nodes)
 	for (int i = 0; i < dim + 1; i++) {
 	  if (mapLocalGlobal)
-	    *ptr_eind = (*mapLocalGlobal)[element->getDOF(i, 0)];
+	    *ptr_eind = (*mapLocalGlobal)[element->getDof(i, 0)];
 	  else
-	    *ptr_eind = element->getDOF(i, 0);
+	    *ptr_eind = element->getDof(i, 0);
 
 	  ptr_eind++;
 	}
@@ -349,7 +349,9 @@ namespace AMDiS {
 
   void ParMetisPartitioner::fillCoarsePartitionVec(std::map<int, int> *partitionVec)
   {
-    TEST_EXIT(partitionVec)("no partition vector\n");
+    FUNCNAME("ParMetisPartitioner::fillCoarsePartitionVec()");
+
+    TEST_EXIT_DBG(partitionVec)("no partition vector\n");
 
     partitionVec->clear();
 
@@ -422,17 +424,17 @@ namespace AMDiS {
     int *partitionElements = new int[nElements];
     int **partitionPtr = new int*[mpiSize];
 
-    sendElements.resize(mpiSize);
-    for (int i = 0; i < mpiSize; i++) {
+    for (int i = 0; i < mpiSize; i++)
       partitionPtr[i] = partitionElements + bufferOffset[i];
-      sendElements[i].clear();
-    }
 
+    sendElements.clear();
     for (int i = 0; i < nElements; i++) {
       int partition = part[i];
       int amdisIndex = parMetisMesh->getAMDiSIndex(i);
 
-      sendElements[partition].push_back(amdisIndex);
+      if (partition != mpiRank)
+	sendElements[partition].push_back(amdisIndex);
+
       *(partitionPtr[partition]) = amdisIndex;
       ++(partitionPtr[partition]);
     }
@@ -460,15 +462,14 @@ namespace AMDiS {
 
     // Create map which stores for each element index on ther partitioning level
     // if the element is in the partition of this rank.
-    recvElements.resize(mpiSize);
+    recvElements.clear();
     for (int i = 0; i < mpiSize; i++) {
-      recvElements[i].clear();
-
       int *rankStart = rankElements + recvBufferOffset[i];
       int *rankEnd = rankStart + nRankElements[i];
       for (int *rankPtr = rankStart; rankPtr < rankEnd; ++rankPtr) {
 	elementInRank[*rankPtr] = true;
-	recvElements[i].push_back(*rankPtr);
+	if (i != mpiRank)
+	  recvElements[i].push_back(*rankPtr);
       }
     }
 
diff --git a/AMDiS/src/parallel/ParMetisPartitioner.h b/AMDiS/src/parallel/ParMetisPartitioner.h
index e9ca5f5bc461e4461a38cae498a316437c616235..9730560f9761fc98b3a8c10a664bd8f10bda9563 100644
--- a/AMDiS/src/parallel/ParMetisPartitioner.h
+++ b/AMDiS/src/parallel/ParMetisPartitioner.h
@@ -202,12 +202,12 @@ namespace AMDiS {
       return elementInRank;
     }
 
-    std::vector<std::vector<int> >& getRecvElements()
+    std::map<int, std::vector<int> >& getRecvElements()
     {
       return recvElements;
     }
 
-    std::vector<std::vector<int> >& getSendElements()
+    std::map<int, std::vector<int> >& getSendElements()
     {
       return sendElements;
     }
@@ -226,7 +226,7 @@ namespace AMDiS {
 
     std::map<int, bool> elementInRank;
 
-    std::vector<std::vector<int> > recvElements, sendElements;
+    std::map<int, std::vector<int> > recvElements, sendElements;
   };
 }
 
diff --git a/AMDiS/src/parallel/PetscSolver.cc b/AMDiS/src/parallel/PetscSolver.cc
index 4f2eaaf98786c45d5419bffb74b1055c358a0c04..0623bbcd73f1e4325d64f976fa5d6e8984765c40 100644
--- a/AMDiS/src/parallel/PetscSolver.cc
+++ b/AMDiS/src/parallel/PetscSolver.cc
@@ -364,6 +364,16 @@ namespace AMDiS {
 	}
       }
     }
+
+    // The above algorithm for calculating the number of nnz per row over-
+    // approximates the value, i.e., the number is always equal or larger to 
+    // the real number of nnz values in the global parallel matrix. For small
+    // matrices, the problem may arise, that the result is larger than the
+    // number of elements in a row. This is fixed in the following.
+
+    if (nRankRows < 100) 
+      for (int i = 0; i < nRankRows; i++)
+	d_nnz[i] = std::min(d_nnz[i], nRankRows);
   }
 
 
diff --git a/AMDiS/src/parallel/StdMpi.cc b/AMDiS/src/parallel/StdMpi.cc
index c22962b10e2ab6ce360eabb46462fced35e89062..b3c27d11655083219b9e96c57752086ed2dd5897 100644
--- a/AMDiS/src/parallel/StdMpi.cc
+++ b/AMDiS/src/parallel/StdMpi.cc
@@ -128,7 +128,7 @@ namespace AMDiS {
     }
   }
 
-  void makeBuf(std::vector<MeshStructure> &data, unsigned long int *buf)
+  void makeBuf(std::vector<MeshStructure> &data, uint64_t *buf)
   {    
     int pos = 0;
     for (unsigned int i = 0; i < data.size(); i++) {
@@ -141,14 +141,14 @@ namespace AMDiS {
   }
 
   void makeFromBuf(std::vector<MeshStructure> &data, 
-		   unsigned long int *buf, int bufSize)
+		   uint64_t *buf, int bufSize)
   {
     int pos = 0;
 
     while (pos < bufSize) {       
       int codeSize = buf[pos++];
       int nElements = buf[pos++];
-      std::vector<long long unsigned int> code;
+      std::vector<uint64_t> code;
       code.resize(codeSize);
       for (int i = 0; i < codeSize; i++)
 	code[i] = buf[pos++];
diff --git a/AMDiS/src/parallel/StdMpi.h b/AMDiS/src/parallel/StdMpi.h
index 379f2a3add2304eeafac98e28581a9968e6eb7b7..c24b530d2503d8417999bac9800f9da54d8e6086 100644
--- a/AMDiS/src/parallel/StdMpi.h
+++ b/AMDiS/src/parallel/StdMpi.h
@@ -23,6 +23,7 @@
 #define AMDIS_STDMPI_H
 
 #include <map>
+#include <stdint.h>
 #include <mpi.h>
 #include "MeshStructure.h"
 #include "parallel/InteriorBoundary.h"
@@ -64,10 +65,10 @@ namespace AMDiS {
 
   void makeFromBuf(std::map<WorldVector<double>, int> &data, double* buf, int bufSize);
 
-  void makeBuf(std::vector<MeshStructure> &data, unsigned long int *buf);
+  void makeBuf(std::vector<MeshStructure> &data, uint64_t *buf);
 
   void makeFromBuf(std::vector<MeshStructure> &data, 
-		   unsigned long int *buf, int bufSize);
+		   uint64_t *buf, int bufSize);
 
   void makeBuf(std::vector<WorldVector<double> > &data, double *buf);