diff --git a/CMakeLists.txt b/CMakeLists.txt
index 287c95026d7bd4f3de7d7c1a089b7ed644e1e0ed..a66fc0842ece9ecad85e305eaff2931809db1e40 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,6 +31,7 @@ ENDIF() # GCC AND GPROF_PATH
 
 # Add subdirectories with the projects
 ADD_SUBDIRECTORY( Base )
+ADD_SUBDIRECTORY( FileIO )
 ADD_SUBDIRECTORY( GeoLib )
 ADD_SUBDIRECTORY( MathLib )
 ADD_SUBDIRECTORY( MeshLib )
diff --git a/GeoLib/PointVec.cpp b/GeoLib/PointVec.cpp
index f59f637ccfbfe369018f1597a0658788b723d575..1b0e588142025a349a454b90ec3f85e4f96e9bc1 100644
--- a/GeoLib/PointVec.cpp
+++ b/GeoLib/PointVec.cpp
@@ -227,17 +227,6 @@ void PointVec::makePntsUnique (std::vector<GEOLIB::Point*>* pnt_vec, std::vector
 		}
 	}
 
-	// KR correct renumbering of indices
-//	size_t cnt(0);
-//	std::map<size_t, size_t> reg_ids;
-//	for (size_t k(0); k < n_pnts_in_file; k++) {
-//		if (pnt_id_map[k] == k) {
-//			reg_ids.insert(std::pair<size_t, size_t>(k, cnt));
-//			cnt++;
-//		} else reg_ids.insert(std::pair<size_t, size_t>(k, reg_ids[pnt_id_map[k]]));
-//	}
-//	for (size_t k(0); k < n_pnts_in_file; k++)
-//		pnt_id_map[k] = reg_ids[k];
 }
 
 void PointVec::calculateShortestDistance ()
diff --git a/MathLib/MathTools.cpp b/MathLib/MathTools.cpp
index c6c20e40b9cf3f711675e93283e5a3da97216daa..d683e1284bd21f6464f05ca0c306367d65a6b6d4 100644
--- a/MathLib/MathTools.cpp
+++ b/MathLib/MathTools.cpp
@@ -86,7 +86,7 @@ double getAngle (const double p0[3], const double p1[3], const double p2[3])
 	return acos (scpr (v0,v1,3) / (sqrt(scpr(v0,v0,3)) * sqrt(scpr (v1,v1,3))));
 }
 
-double calcDetTriangle(const double p0[3], const double p1[3],	const double p2[3])
+double calcTriangleaArea(const double p0[3], const double p1[3],	const double p2[3])
 {
 	const double u0 (p2[0] - p0[0]);
 	const double u1 (p2[1] - p0[1]);
@@ -103,7 +103,7 @@ double calcDetTriangle(const double p0[3], const double p1[3],	const double p2[3
 	return 0.5 * sqrt(z0*z0 + z1*z1 + z2 * z2);
 }
 
-double calcDetTetrahedron(const double* x1, const double* x2, const double* x3, const double* x4)
+double calcTetrahedronVolume(const double* x1, const double* x2, const double* x3, const double* x4)
 {
 	return fabs((x1[0] - x4[0]) * ((x2[1] - x4[1]) * (x3[2] - x4[2]) - (x2[2] - x4[2]) * (x3[1] - x4[1]))
 	          - (x1[1] - x4[1]) * ((x2[0] - x4[0]) * (x3[2] - x4[2]) - (x2[2] - x4[2]) * (x3[0] - x4[0]))
diff --git a/MathLib/MathTools.h b/MathLib/MathTools.h
index d60865652754b3483f6220ade9f02732c7701bd3..5200b78726a0d4cd5f9a0236e13c5c050a12cc64 100644
--- a/MathLib/MathTools.h
+++ b/MathLib/MathTools.h
@@ -94,9 +94,17 @@ float normalize(float min, float max, float val);
  */
 double getAngle (const double p0[3], const double p1[3], const double p2[3]);
 
-double calcDetTriangle(const double p0[3], const double p1[3],	const double p2[3]);
+/** 
+ * Calculates the area of a triangle. 
+ * The formula is A=.5*|u x v|, i.e. half of the area of the parallelogram specified by u=p0->p1 and v=p0->p2.
+ */
+double calcTriangleArea(const double p0[3], const double p1[3],	const double p2[3]);
 
-double calcDetTetrahedron(const double* x1, const double* x2, const double* x3, const double* x4);
+/** 
+ * Calculates the volume of a tetrahedron. 
+ * The formula is V=1/6*|a(b x c)| with a=x1->x2, b=x1->x3 and c=x1->x4.
+ */
+double calcTetrahedronVolume(const double* x1, const double* x2, const double* x3, const double* x4);
 
 /**
  * simple power function that takes as a second argument an integer instead of a float
diff --git a/MeshLib/Elements/Cell.cpp b/MeshLib/Elements/Cell.cpp
index 307bc9be0ebee9e3b2f35d55b8ae400e8bf74650..84a19214e08e273609e3da3ecb244d107b7186ab 100644
--- a/MeshLib/Elements/Cell.cpp
+++ b/MeshLib/Elements/Cell.cpp
@@ -9,12 +9,12 @@
 
 namespace MeshLib {
 /*
-Cell::Cell(Node** nodes, MshElemType::type type, size_t value)
+Cell::Cell(Node** nodes, MshElemType::type type, unsigned value)
 	: Element(nodes, type, value)
 {
 }
 */
-Cell::Cell(MshElemType::type type, size_t value)
+Cell::Cell(MshElemType::type type, unsigned value)
 	: Element(type, value)
 {
 }
diff --git a/MeshLib/Elements/Cell.h b/MeshLib/Elements/Cell.h
index 81f434cb88515de49688f23e8e7851d0d2755bc6..4ed841032991df2569a70267159d948d4bc5baf1 100644
--- a/MeshLib/Elements/Cell.h
+++ b/MeshLib/Elements/Cell.h
@@ -22,7 +22,7 @@ public:
 	virtual double getVolume() const { return _volume; };
 
 	/// Get dimension of the mesh element.
-	size_t getDimension() const { return 3; };
+	unsigned getDimension() const { return 3; };
 
 	/// Destructor
 	virtual ~Cell();
@@ -30,10 +30,10 @@ public:
 protected:
 /*
 	/// Constructor for a generic mesh element containing an array of mesh nodes.
-	Cell(Node** nodes, MshElemType::type type, size_t value = 0);
+	Cell(Node** nodes, MshElemType::type type, unsigned value = 0);
 */
 	/// Constructor for a generic mesh element without an array of mesh nodes.
-	Cell(MshElemType::type type, size_t value = 0);
+	Cell(MshElemType::type type, unsigned value = 0);
 
 	/// Calculate the volume of this 3d element.
 	virtual double calcVolume() = 0;
@@ -42,7 +42,7 @@ protected:
 
 }; /* class */
 
-} /* namespace */
+}		
 
 #endif /* CELL_H_ */
 
diff --git a/MeshLib/Elements/Edge.cpp b/MeshLib/Elements/Edge.cpp
index 836f3eb36278b8ebcfe7029df4c698ee1f58e102..66032d35039962bd558940c169983a4d5c2c38e7 100644
--- a/MeshLib/Elements/Edge.cpp
+++ b/MeshLib/Elements/Edge.cpp
@@ -12,14 +12,14 @@
 
 namespace MeshLib {
 
-Edge::Edge(Node* nodes[2], size_t value)
+Edge::Edge(Node* nodes[2], unsigned value)
 	: Element(MshElemType::LINE, value)
 {
 	_nodes = nodes;
 	this->_length = this->calcLength();
 }
 
-Edge::Edge(Node* n0, Node* n1, size_t value)
+Edge::Edge(Node* n0, Node* n1, unsigned value)
 	: Element(MshElemType::LINE, value)
 {
 	_nodes = new Node*[2];
diff --git a/MeshLib/Elements/Edge.h b/MeshLib/Elements/Edge.h
index 13e7e78dc241342cb31bab65c3a4ac096eb6a8f3..3eb34c5620927bbd36cf830c41c1d9f1904f2f4c 100644
--- a/MeshLib/Elements/Edge.h
+++ b/MeshLib/Elements/Edge.h
@@ -27,10 +27,10 @@ class Edge : public Element
 {
 public:
 	/// Constructor with an array of mesh nodes.
-	Edge(Node* nodes[2], size_t value = 0);
+	Edge(Node* nodes[2], unsigned value = 0);
 
 	/// Constructor using single nodes
-	Edge(Node* n1, Node* n2, size_t value = 0);
+	Edge(Node* n1, Node* n2, unsigned value = 0);
 
 	/// Copy constructor
 	Edge(const Edge &edge);
@@ -39,22 +39,22 @@ public:
 	virtual ~Edge();
 
 	/// 1D elements have no edges
-	size_t getNEdges() const { return 0; };
+	unsigned getNEdges() const { return 0; };
 
 	/// Get the number of faces for this element.
-	size_t getNFaces() const { return 0; };
+	unsigned getNFaces() const { return 0; };
 
 	/// Get the length of this 1d element.
 	double getLength() const { return _length; };
 
 	/// Get dimension of the mesh element.
-	size_t getDimension() const { return 1; };
+	unsigned getDimension() const { return 1; };
 
 	/// Get the number of neighbors for this element.
-	size_t getNNeighbors() const { return 0; };
+	unsigned getNNeighbors() const { return 0; };
 
 	/// Get the number of nodes for this element.
-	virtual size_t getNNodes() const { return 2; };
+	virtual unsigned getNNodes() const { return 2; };
 
 
 protected:
diff --git a/MeshLib/Elements/Element.cpp b/MeshLib/Elements/Element.cpp
index faf6b77a99cc6455223f3d4079e17e404e41c036..8b9fccd9889a43f3cac89ccd5a3aac39c2e065e7 100644
--- a/MeshLib/Elements/Element.cpp
+++ b/MeshLib/Elements/Element.cpp
@@ -13,12 +13,12 @@
 namespace MeshLib {
 
 /*
-Element::Element(Node** nodes, MshElemType::type type, size_t value)
+Element::Element(Node** nodes, MshElemType::type type, unsigned value)
 	: _nodes(nodes), _type(type), _value(value)
 {
 }
 */
-Element::Element(MshElemType::type type, size_t value)
+Element::Element(MshElemType::type type, unsigned value)
 	: _nodes(NULL), _type(type), _value(value)
 {
 }
@@ -29,20 +29,20 @@ Element::~Element()
 	delete[] this->_neighbors;
 }
 
-const Element* Element::getNeighbor(size_t i) const
+const Element* Element::getNeighbor(unsigned i) const
 {
 	assert(i < getNNeighbors() && "Error in MeshLib::Element::getNeighbor() - Index does not exist.");
 	return _neighbors[i];
 }
 
-const Node* Element::getNode(size_t i) const
+const Node* Element::getNode(unsigned i) const
 {
 	assert(i < getNNodes() && "Error in MeshLib::Element::getNode() - Index does not exist.");
 	assert(_nodes[i] != NULL && "Error in MeshLib::Element::getNode() - Node is NULL.");
 	return _nodes[i];
 }
 
-size_t Element::getNodeIndex(size_t i) const 
+unsigned Element::getNodeIndex(unsigned i) const 
 {
 	assert(i<getNNodes() && "Error in MeshLib::Element::getNodeIndex() - Index does not exist.");
 	return _nodes[i]->getID();
@@ -50,8 +50,8 @@ size_t Element::getNodeIndex(size_t i) const
 
 bool Element::hasNeighbor(Element* elem) const
 {
-	size_t nNeighbors (this->getNNeighbors());
-	for (size_t i=0; i<nNeighbors; i++)
+	unsigned nNeighbors (this->getNNeighbors());
+	for (unsigned i=0; i<nNeighbors; i++)
 		if (this->_neighbors[i]==elem)
 			return true;
 	return false;
diff --git a/MeshLib/Elements/Element.h b/MeshLib/Elements/Element.h
index d3a4d20265ab518138d3691c068bfbb7950316db..3e07b798d0cc0e5fa8f4b6cd3498fc8151aca971 100644
--- a/MeshLib/Elements/Element.h
+++ b/MeshLib/Elements/Element.h
@@ -21,39 +21,44 @@ class Node;
  */
 class Element
 {
+	/* friend functions: */
+	friend void Mesh::setElementInformationForNodes();
+	friend void Mesh::addElement(Element*);
+	
+
 public:
 	/// Get node with local index i.
-	const Node* getNode(size_t i) const;
+	const Node* getNode(unsigned i) const;
 
 	/// Get array of element nodes.
 	Node* const* getNodes() const { return _nodes; };
 
 	/// Get dimension of the mesh element.
-	virtual size_t getDimension() const = 0;
+	virtual unsigned getDimension() const = 0;
 
 	/// Get the number of edges for this element.
-	virtual size_t getNEdges() const = 0;
+	virtual unsigned getNEdges() const = 0;
 
 	/// Get the number of faces for this element.
-	virtual size_t getNFaces() const = 0;
+	virtual unsigned getNFaces() const = 0;
 
 	/// Get the specified neighbor.
-	const Element* getNeighbor(size_t i) const;
+	const Element* getNeighbor(unsigned i) const;
 
 	/// Get the number of neighbors for this element.
-	virtual size_t getNNeighbors() const = 0;
+	virtual unsigned getNNeighbors() const = 0;
 
 	/// Get the number of nodes for this element.
-	virtual size_t getNNodes() const = 0;
+	virtual unsigned getNNodes() const = 0;
 
 	/// Get the global index for the node with local index i.
-	size_t getNodeIndex(size_t i) const;
+	unsigned getNodeIndex(unsigned i) const;
 
 	/// Get the type of the mesh element (as a MshElemType-enum).
 	MshElemType::type getType() const { return _type; };
 
 	/// Get the value for this element.
-	size_t getValue() const { return _value; };
+	unsigned getValue() const { return _value; };
 
 	bool hasNeighbor(Element* elem) const;
 
@@ -63,27 +68,18 @@ public:
 protected:
 /*
 	/// Constructor for a generic mesh element containing an array of mesh nodes.
-	Element(Node** nodes, MshElemType::type type, size_t value = 0);
+	Element(Node** nodes, MshElemType::type type, unsigned value = 0);
 */
 	/// Constructor for a generic mesh element without an array of mesh nodes.
-	Element(MshElemType::type type, size_t value = 0);
-
-	/**
-	 * Get an editale Node.
-	 * This method is called by Mesh::addElement(Element*), see friend definition.
-	 */
-	Node* getNode(size_t i);
+	Element(MshElemType::type type, unsigned value = 0);
 
 	Node** _nodes;
 	MshElemType::type _type;
-	size_t _value;
+	unsigned _value;
 	Element** _neighbors;
 
 private:
 
-/* friend functions: */
-	friend void Mesh::addElement(Element*);
-
 }; /* class */
 
 } /* namespace */
diff --git a/MeshLib/Elements/Face.cpp b/MeshLib/Elements/Face.cpp
index 9692e245b37499ecac3f85079f230d88b8a58ef5..8648f35b256ca12adca159a978bc91210759c556 100644
--- a/MeshLib/Elements/Face.cpp
+++ b/MeshLib/Elements/Face.cpp
@@ -9,12 +9,12 @@
 
 namespace MeshLib {
 /*
-Face::Face(Node** nodes, MshElemType::type type, size_t value)
+Face::Face(Node** nodes, MshElemType::type type, unsigned value)
 	: Element(nodes, type, value)
 {
 }
 */
-Face::Face(MshElemType::type type, size_t value)
+Face::Face(MshElemType::type type, unsigned value)
 	: Element(type, value)
 {
 }
diff --git a/MeshLib/Elements/Face.h b/MeshLib/Elements/Face.h
index 2509be570ff780008b8de06d24edffbbf8b69af1..de97de3945ac90f6d77f2222bec0776b22418524 100644
--- a/MeshLib/Elements/Face.h
+++ b/MeshLib/Elements/Face.h
@@ -22,10 +22,10 @@ public:
 	virtual double getArea() const { return _area; };
 
 	/// Get dimension of the mesh element.
-	size_t getDimension() const { return 2; };
+	unsigned getDimension() const { return 2; };
 
 	/// 2D elements have no faces.
-	size_t getNFaces() const { return 0; };
+	unsigned getNFaces() const { return 0; };
 
 	/// Destructor
 	virtual ~Face();
@@ -33,10 +33,10 @@ public:
 protected:
 /*
 	/// Constructor for a generic mesh element containing an array of mesh nodes.
-	Face(Node** nodes, MshElemType::type type, size_t value = 0);
+	Face(Node** nodes, MshElemType::type type, unsigned value = 0);
 */
 	/// Constructor for a generic mesh element without an array of mesh nodes.
-	Face(MshElemType::type type, size_t value = 0);
+	Face(MshElemType::type type, unsigned value = 0);
 
 	/// Calculate the area of this 2d element.
 	virtual double calcArea() = 0;
diff --git a/MeshLib/Elements/FemElem.cpp b/MeshLib/Elements/FemElem.cpp
index 602406a65c91abaec4cc3cbd7aea9ddff92331a7..fc64795c9a6357918d0f4e503cbb5ac3d161397c 100644
--- a/MeshLib/Elements/FemElem.cpp
+++ b/MeshLib/Elements/FemElem.cpp
@@ -10,12 +10,12 @@
 namespace MeshLib {
 
 FemElem::FemElem()
-	: _centre_of_gravity(GEOLIB::Point(0,0,0))
+	: _centroid(GEOLIB::Point(0,0,0))
 {
 }
 
 FemElem::FemElem(const FemElem &elem)
-	: _centre_of_gravity(elem.getCentreOfGravity())
+	: _centroid(elem.getCentroid())
 {
 }
 
diff --git a/MeshLib/Elements/FemElem.h b/MeshLib/Elements/FemElem.h
index 8d7127b2ea82ce84040aaf158eccc8b966f71d5b..b75265450b04d9b5155a4b2581c8047ea1fb3b22 100644
--- a/MeshLib/Elements/FemElem.h
+++ b/MeshLib/Elements/FemElem.h
@@ -22,7 +22,7 @@ public:
 	virtual ~FemElem();
 
 	/// Get the number of nodes for this element.
-	const GEOLIB::Point& getCentreOfGravity() const { return _centre_of_gravity; };
+	const GEOLIB::Point& getCentroid() const { return _centroid; };
 
 protected:
 	/// Constructor.
@@ -32,9 +32,9 @@ protected:
 	FemElem(const FemElem &elem);
 
 	/// Calculate centre of gravity
-	virtual void calcCoG() = 0;
+	virtual void calcCentroid() = 0;
 
-	GEOLIB::Point _centre_of_gravity;
+	GEOLIB::Point _centroid;
 
 }; /* class */
 
diff --git a/MeshLib/Elements/Hex.cpp b/MeshLib/Elements/Hex.cpp
index b89c6ca4494f0287d2471daac53bbaa16c589328..c1ce664eb576e01e6524e0662a9d2e39aafdc7fb 100644
--- a/MeshLib/Elements/Hex.cpp
+++ b/MeshLib/Elements/Hex.cpp
@@ -13,17 +13,17 @@
 
 namespace MeshLib {
 
-Hex::Hex(Node* nodes[8], size_t value)
+Hex::Hex(Node* nodes[8], unsigned value)
 	: Cell(MshElemType::HEXAHEDRON, value)
 {
 	_nodes = nodes;
 	_neighbors = new Element*[6];
-	for (size_t i=0; i<6; i++)
+	for (unsigned i=0; i<6; i++)
 		_neighbors[i] = NULL;
 	this->_volume = this->calcVolume();
 }
 
-Hex::Hex(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, Node* n6, Node* n7, size_t value)
+Hex::Hex(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, Node* n6, Node* n7, unsigned value)
 	: Cell(MshElemType::HEXAHEDRON, value)
 {
 	_nodes = new Node*[8];
@@ -36,7 +36,7 @@ Hex::Hex(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, Node* n6, N
 	_nodes[6] = n6;
 	_nodes[7] = n7;
 	_neighbors = new Element*[6];
-	for (size_t i=0; i<6; i++)
+	for (unsigned i=0; i<6; i++)
 		_neighbors[i] = NULL;
 	this->_volume = this->calcVolume();
 }
@@ -45,10 +45,10 @@ Hex::Hex(const Hex &hex)
 	: Cell(MshElemType::HEXAHEDRON, hex.getValue())
 {
 	_nodes = new Node*[8];
-	for (size_t i=0; i<8; i++)
+	for (unsigned i=0; i<8; i++)
 		_nodes[i] = hex._nodes[i];
 	_neighbors = new Element*[6];
-	for (size_t i=0; i<6; i++)
+	for (unsigned i=0; i<6; i++)
 		_neighbors[i] = hex._neighbors[i];
 	_volume = hex.getVolume();
 }
@@ -59,12 +59,12 @@ Hex::~Hex()
 
 double Hex::calcVolume()
 {
-	return MathLib::calcDetTetrahedron(_nodes[4]->getData(), _nodes[7]->getData(), _nodes[5]->getData(), _nodes[0]->getData())
-		 + MathLib::calcDetTetrahedron(_nodes[5]->getData(), _nodes[3]->getData(), _nodes[1]->getData(), _nodes[0]->getData())
-		 + MathLib::calcDetTetrahedron(_nodes[5]->getData(), _nodes[7]->getData(), _nodes[3]->getData(), _nodes[0]->getData())
-		 + MathLib::calcDetTetrahedron(_nodes[5]->getData(), _nodes[7]->getData(), _nodes[6]->getData(), _nodes[2]->getData())
-		 + MathLib::calcDetTetrahedron(_nodes[1]->getData(), _nodes[3]->getData(), _nodes[5]->getData(), _nodes[2]->getData())
-		 + MathLib::calcDetTetrahedron(_nodes[3]->getData(), _nodes[7]->getData(), _nodes[5]->getData(), _nodes[2]->getData());
+	return MathLib::calcTetrahedronVolume(_nodes[4]->getData(), _nodes[7]->getData(), _nodes[5]->getData(), _nodes[0]->getData())
+		 + MathLib::calcTetrahedronVolume(_nodes[5]->getData(), _nodes[3]->getData(), _nodes[1]->getData(), _nodes[0]->getData())
+		 + MathLib::calcTetrahedronVolume(_nodes[5]->getData(), _nodes[7]->getData(), _nodes[3]->getData(), _nodes[0]->getData())
+		 + MathLib::calcTetrahedronVolume(_nodes[5]->getData(), _nodes[7]->getData(), _nodes[6]->getData(), _nodes[2]->getData())
+		 + MathLib::calcTetrahedronVolume(_nodes[1]->getData(), _nodes[3]->getData(), _nodes[5]->getData(), _nodes[2]->getData())
+		 + MathLib::calcTetrahedronVolume(_nodes[3]->getData(), _nodes[7]->getData(), _nodes[5]->getData(), _nodes[2]->getData());
 }
 
 }
diff --git a/MeshLib/Elements/Hex.h b/MeshLib/Elements/Hex.h
index 56d488b9c2ca47607499d241668f915a5bffbf53..a78a02bf830bf5695f5a8198c05f08cc639dc1d3 100644
--- a/MeshLib/Elements/Hex.h
+++ b/MeshLib/Elements/Hex.h
@@ -35,10 +35,10 @@ class Hex : public Cell
 {
 public:
 	/// Constructor with an array of mesh nodes.
-	Hex(Node* nodes[8], size_t value = 0);
+	Hex(Node* nodes[8], unsigned value = 0);
 
 	/// Constructor using single mesh nodes.
-	Hex(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, Node* n6, Node* n7, size_t value);
+	Hex(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, Node* n6, Node* n7, unsigned value);
 
 	/// Copy constructor
 	Hex(const Hex &hex);
@@ -47,16 +47,16 @@ public:
 	virtual ~Hex();
 
 	/// Get the number of edges for this element.
-	size_t getNEdges() const { return 12; };
+	unsigned getNEdges() const { return 12; };
 
 	/// Get the number of faces for this element.
-	size_t getNFaces() const { return 6; };
+	unsigned getNFaces() const { return 6; };
 
 	/// Get the number of neighbors for this element.
-	size_t getNNeighbors() const { return 6; };
+	unsigned getNNeighbors() const { return 6; };
 
 	/// Get the number of nodes for this element.
-	virtual size_t getNNodes() const { return 8; };
+	virtual unsigned getNNodes() const { return 8; };
 
 protected:
 	/// Calculates the volume of a convex hexahedron by partitioning it into six tetrahedra.
diff --git a/MeshLib/Elements/Prism.cpp b/MeshLib/Elements/Prism.cpp
index cf9b8e5046c7cbbd6ce503c15f1ccc4cc3bb2739..8ba4843a5945d7e70807f08fd63aec27c3e386d2 100644
--- a/MeshLib/Elements/Prism.cpp
+++ b/MeshLib/Elements/Prism.cpp
@@ -12,17 +12,17 @@
 
 namespace MeshLib {
 
-Prism::Prism(Node* nodes[6], size_t value)
+Prism::Prism(Node* nodes[6], unsigned value)
 	: Cell(MshElemType::PRISM, value)
 {
 	_nodes = _nodes;
 	_neighbors = new Element*[5];
-	for (size_t i=0; i<5; i++)
+	for (unsigned i=0; i<5; i++)
 		_neighbors[i] = NULL;
 	this->_volume = this->calcVolume();
 }
 
-Prism::Prism(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, size_t value)
+Prism::Prism(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, unsigned value)
 	: Cell(MshElemType::PRISM, value)
 {
 	_nodes = new Node*[6];
@@ -33,7 +33,7 @@ Prism::Prism(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, size_t
 	_nodes[4] = n4;
 	_nodes[5] = n5;
 	_neighbors = new Element*[5];
-	for (size_t i=0; i<5; i++)
+	for (unsigned i=0; i<5; i++)
 		_neighbors[i] = NULL;
 	this->_volume = this->calcVolume();
 }
@@ -42,10 +42,10 @@ Prism::Prism(const Prism &prism)
 	: Cell(MshElemType::PRISM, prism.getValue())
 {
 	_nodes = new Node*[6];
-	for (size_t i=0; i<6; i++)
+	for (unsigned i=0; i<6; i++)
 		_nodes[i] = prism._nodes[i];
 	_neighbors = new Element*[5];
-	for (size_t i=0; i<5; i++)
+	for (unsigned i=0; i<5; i++)
 		_neighbors[i] = prism._neighbors[i];
 	_volume = prism.getVolume();
 }
@@ -56,9 +56,9 @@ Prism::~Prism()
 
 double Prism::calcVolume()
 {
-	return MathLib::calcDetTetrahedron(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData(), _nodes[3]->getData())
-		 + MathLib::calcDetTetrahedron(_nodes[1]->getData(), _nodes[4]->getData(), _nodes[2]->getData(), _nodes[3]->getData())
-		 + MathLib::calcDetTetrahedron(_nodes[2]->getData(), _nodes[4]->getData(), _nodes[5]->getData(), _nodes[3]->getData());
+	return MathLib::calcTetrahedronVolume(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData(), _nodes[3]->getData())
+		 + MathLib::calcTetrahedronVolume(_nodes[1]->getData(), _nodes[4]->getData(), _nodes[2]->getData(), _nodes[3]->getData())
+		 + MathLib::calcTetrahedronVolume(_nodes[2]->getData(), _nodes[4]->getData(), _nodes[5]->getData(), _nodes[3]->getData());
 }
 
 }
diff --git a/MeshLib/Elements/Prism.h b/MeshLib/Elements/Prism.h
index e36d0b901633b655acbab4fe186a8bf0d89005db..f7781110f0813db270467d02462f9e63654eb685 100644
--- a/MeshLib/Elements/Prism.h
+++ b/MeshLib/Elements/Prism.h
@@ -33,10 +33,10 @@ class Prism : public Cell
 {
 public:
 	/// Constructor with an array of mesh nodes.
-	Prism(Node* nodes[6], size_t value = 0);
+	Prism(Node* nodes[6], unsigned value = 0);
 
 	/// Constructor using single mesh nodes.
-	Prism(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, size_t value = 0);
+	Prism(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, unsigned value = 0);
 
 	/// Copy constructor
 	Prism(const Prism &prism);
@@ -45,16 +45,16 @@ public:
 	virtual ~Prism();
 
 	/// Get the number of edges for this element.
-	size_t getNEdges() const { return 9; };
+	unsigned getNEdges() const { return 9; };
 
 	/// Get the number of faces for this element.
-	size_t getNFaces() const { return 5; };
+	unsigned getNFaces() const { return 5; };
 
 	/// Get the number of neighbors for this element.
-	size_t getNNeighbors() const { return 5; };
+	unsigned getNNeighbors() const { return 5; };
 
 	/// Get the number of nodes for this element.
-	virtual size_t getNNodes() const { return 6; };
+	virtual unsigned getNNodes() const { return 6; };
 
 protected:
 	/// Calculates the volume of a prism by subdividing it into three tetrahedra.
diff --git a/MeshLib/Elements/Pyramid.cpp b/MeshLib/Elements/Pyramid.cpp
index bea57f8bf64a25c4e49e434e1afb78b983907736..ad78982230b0a25171025b906dd233b6464d4941 100644
--- a/MeshLib/Elements/Pyramid.cpp
+++ b/MeshLib/Elements/Pyramid.cpp
@@ -12,17 +12,17 @@
 
 namespace MeshLib {
 
-Pyramid::Pyramid(Node* nodes[5], size_t value)
+Pyramid::Pyramid(Node* nodes[5], unsigned value)
 	: Cell(MshElemType::PYRAMID, value)
 {
 	_nodes = nodes;
 	_neighbors = new Element*[5];
-	for (size_t i=0; i<5; i++)
+	for (unsigned i=0; i<5; i++)
 		_neighbors[i] = NULL;
 	this->_volume = this->calcVolume();
 }
 
-Pyramid::Pyramid(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, size_t value)
+Pyramid::Pyramid(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, unsigned value)
 	: Cell(MshElemType::PYRAMID, value)
 {
 	_nodes = new Node*[5];
@@ -32,7 +32,7 @@ Pyramid::Pyramid(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, size_t value)
 	_nodes[3] = n3;
 	_nodes[4] = n4;
 	_neighbors = new Element*[5];
-	for (size_t i=0; i<5; i++)
+	for (unsigned i=0; i<5; i++)
 		_neighbors[i] = NULL;
 
 	this->_volume = this->calcVolume();
@@ -43,7 +43,7 @@ Pyramid::Pyramid(const Pyramid &pyramid)
 {
 	_nodes = new Node*[5];
 	_neighbors = new Element*[5];
-	for (size_t i=0; i<5; i++)
+	for (unsigned i=0; i<5; i++)
 	{
 		_nodes[i] = pyramid._nodes[i];
 		_neighbors[i] = pyramid._neighbors[i];
@@ -57,8 +57,8 @@ Pyramid::~Pyramid()
 
 double Pyramid::calcVolume()
 {
-	return MathLib::calcDetTetrahedron(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData(), _nodes[4]->getData())
-		 + MathLib::calcDetTetrahedron(_nodes[2]->getData(), _nodes[3]->getData(), _nodes[0]->getData(), _nodes[4]->getData());
+	return MathLib::calcTetrahedronVolume(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData(), _nodes[4]->getData())
+		 + MathLib::calcTetrahedronVolume(_nodes[2]->getData(), _nodes[3]->getData(), _nodes[0]->getData(), _nodes[4]->getData());
 }
 
 }
diff --git a/MeshLib/Elements/Pyramid.h b/MeshLib/Elements/Pyramid.h
index 10f9715b37ff1ec3a3fed183509ad61467ebc306..f22435e3a7e1c4c9fe591510937b6a8770401f8a 100644
--- a/MeshLib/Elements/Pyramid.h
+++ b/MeshLib/Elements/Pyramid.h
@@ -33,10 +33,10 @@ class Pyramid : public Cell
 {
 public:
 	/// Constructor with an array of mesh nodes.
-	Pyramid(Node* nodes[5], size_t value = 0);
+	Pyramid(Node* nodes[5], unsigned value = 0);
 
 	/// Constructor using single mesh nodes.
-	Pyramid(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, size_t value = 0);
+	Pyramid(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, unsigned value = 0);
 
 	/// Copy constructor
 	Pyramid(const Pyramid &pyramid);
@@ -45,16 +45,16 @@ public:
 	virtual ~Pyramid();
 
 	/// Get the number of edges for this element.
-	size_t getNEdges() const { return 8; };
+	unsigned getNEdges() const { return 8; };
 
 	/// Get the number of faces for this element.
-	size_t getNFaces() const { return 5; };
+	unsigned getNFaces() const { return 5; };
 
 	/// Get the number of neighbors for this element.
-	size_t getNNeighbors() const { return 5; };
+	unsigned getNNeighbors() const { return 5; };
 
 	/// Get the number of nodes for this element.
-	virtual size_t getNNodes() const { return 5; };
+	virtual unsigned getNNodes() const { return 5; };
 
 protected:
 	/// Calculates the volume of a prism by subdividing it into two tetrahedra.
diff --git a/MeshLib/Elements/Quad.cpp b/MeshLib/Elements/Quad.cpp
index 61dc76e74752a73a689eb6d43b7bc347234bcdd4..2fda1b6dfdd5e8efbde3105a3b9515e0f4f35afb 100644
--- a/MeshLib/Elements/Quad.cpp
+++ b/MeshLib/Elements/Quad.cpp
@@ -12,17 +12,17 @@
 	
 namespace MeshLib {
 
-Quad::Quad(Node* nodes[4], size_t value)
+Quad::Quad(Node* nodes[4], unsigned value)
 	: Face(MshElemType::TRIANGLE, value)
 {
 	_nodes = nodes;
 	_neighbors = new Element*[4];
-	for (size_t i=0; i<4; i++)
+	for (unsigned i=0; i<4; i++)
 		_neighbors[i] = NULL;
 	this->_area = this->calcArea();
 }
 
-Quad::Quad(Node* n0, Node* n1, Node* n2, Node* n3, size_t value)
+Quad::Quad(Node* n0, Node* n1, Node* n2, Node* n3, unsigned value)
 	: Face(MshElemType::TRIANGLE, value)
 {
 	_nodes = new Node*[4];
@@ -31,7 +31,7 @@ Quad::Quad(Node* n0, Node* n1, Node* n2, Node* n3, size_t value)
 	_nodes[2] = n2;
 	_nodes[3] = n3;
 	_neighbors = new Element*[4];
-	for (size_t i=0; i<4; i++)
+	for (unsigned i=0; i<4; i++)
 		_neighbors[i] = NULL;
 	this->_area = this->calcArea();
 }
@@ -41,7 +41,7 @@ Quad::Quad(const Quad &quad)
 {
 	_nodes = new Node*[4];
 	_neighbors = new Element*[4];
-	for (size_t i=0; i<4; i++)
+	for (unsigned i=0; i<4; i++)
 	{
 		_nodes[i] = quad._nodes[i];
 		_neighbors[i] = quad._neighbors[i];
@@ -55,8 +55,8 @@ Quad::~Quad()
 
 double Quad::calcArea()
 {
-	return MathLib::calcDetTriangle(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData())
-         + MathLib::calcDetTriangle(_nodes[2]->getData(), _nodes[3]->getData(), _nodes[0]->getData());
+	return MathLib::calcTriangleArea(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData())
+         + MathLib::calcTriangleArea(_nodes[2]->getData(), _nodes[3]->getData(), _nodes[0]->getData());
 }
 
 }
diff --git a/MeshLib/Elements/Quad.h b/MeshLib/Elements/Quad.h
index 8ba871af1038413a01c89508aa22e151daf51b0d..fdc7aea0212f56e9d6575fcc50b5c804497b8ef9 100644
--- a/MeshLib/Elements/Quad.h
+++ b/MeshLib/Elements/Quad.h
@@ -32,10 +32,10 @@ class Quad : public Face
 {
 public:
 	/// Constructor with an array of mesh nodes.
-	Quad(Node* nodes[4], size_t value = 0);
+	Quad(Node* nodes[4], unsigned value = 0);
 
 	/// Constructor using single mesh nodes.
-	Quad(Node* n0, Node* n1, Node* n2, Node* n3, size_t value = 0);
+	Quad(Node* n0, Node* n1, Node* n2, Node* n3, unsigned value = 0);
 
 	/// Copy constructor
 	Quad(const Quad &quad);
@@ -44,13 +44,13 @@ public:
 	virtual ~Quad();
 
 	/// Get the number of edges for this element.
-	size_t getNEdges() const { return 4; };
+	unsigned getNEdges() const { return 4; };
 
 	/// Get the number of neighbors for this element.
-	size_t getNNeighbors() const { return 4; };
+	unsigned getNNeighbors() const { return 4; };
 
 	/// Get the number of nodes for this element.
-	virtual size_t getNNodes() const { return 4; };
+	virtual unsigned getNNodes() const { return 4; };
 
 protected:
 	/// Calculates the area of a convex quadliteral by dividing it into two triangles.
diff --git a/MeshLib/Elements/Tet.cpp b/MeshLib/Elements/Tet.cpp
index d9a8aa5918e533ab4dd2b732a8de3f70cb5a2b2f..c51918dd60dc44d444db0fc0780a1917e6b03ebd 100644
--- a/MeshLib/Elements/Tet.cpp
+++ b/MeshLib/Elements/Tet.cpp
@@ -12,17 +12,17 @@
 
 namespace MeshLib {
 
-Tet::Tet(Node* nodes[4], size_t value)
+Tet::Tet(Node* nodes[4], unsigned value)
 	: Cell(MshElemType::TETRAHEDRON, value)
 {
 	_nodes = nodes;
 	_neighbors = new Element*[4];
-	for (size_t i=0; i<4; i++)
+	for (unsigned i=0; i<4; i++)
 		_neighbors[i] = NULL;
 	this->_volume = this->calcVolume();
 }
 
-Tet::Tet(Node* n0, Node* n1, Node* n2, Node* n3, size_t value)
+Tet::Tet(Node* n0, Node* n1, Node* n2, Node* n3, unsigned value)
 	: Cell(MshElemType::TETRAHEDRON, value)
 {
 	_nodes = new Node*[4];
@@ -31,16 +31,16 @@ Tet::Tet(Node* n0, Node* n1, Node* n2, Node* n3, size_t value)
 	_nodes[2] = n2;
 	_nodes[3] = n3;
 	_neighbors = new Element*[4];
-	for (size_t i=0; i<4; i++)
+	for (unsigned i=0; i<4; i++)
 		_neighbors[i] = NULL;
 	this->_volume = this->calcVolume();
 }
 
-Tet::Tet(size_t value)
+Tet::Tet(unsigned value)
 	: Cell(MshElemType::TETRAHEDRON, value)
 {
 	_neighbors = new Element*[4];
-	for (size_t i=0; i<4; i++)
+	for (unsigned i=0; i<4; i++)
 		_neighbors[i] = NULL;
 }
 
@@ -49,7 +49,7 @@ Tet::Tet(const Tet &tet)
 {
 	_nodes = new Node*[4];
 	_neighbors = new Element*[4];
-	for (size_t i=0; i<4; i++)
+	for (unsigned i=0; i<4; i++)
 	{
 		_nodes[i] = tet._nodes[i];
 		_neighbors[i] = tet._neighbors[i];
@@ -63,7 +63,7 @@ Tet::~Tet()
 
 double Tet::calcVolume()
 {
-	return MathLib::calcDetTetrahedron(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData(), _nodes[3]->getData());
+	return MathLib::calcTetrahedronVolume(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData(), _nodes[3]->getData());
 }
 
 }
diff --git a/MeshLib/Elements/Tet.h b/MeshLib/Elements/Tet.h
index e6ac4c9c5d3f85e606424929847fa0ae20fef574..a9b7f4dd8b14ca39d97f95bc824807aed0ee826e 100644
--- a/MeshLib/Elements/Tet.h
+++ b/MeshLib/Elements/Tet.h
@@ -34,10 +34,10 @@ class Tet : public Cell
 {
 public:
 	/// Constructor with an array of mesh nodes.
-	Tet(Node* nodes[4], size_t value = 0);
+	Tet(Node* nodes[4], unsigned value = 0);
 
 	/// Constructor using single mesh nodes.
-	Tet(Node* n0, Node* n1, Node* n2, Node* n3, size_t value = 0);
+	Tet(Node* n0, Node* n1, Node* n2, Node* n3, unsigned value = 0);
 
 	/// Copy constructor
 	Tet(const Tet &tet);
@@ -46,20 +46,20 @@ public:
 	virtual ~Tet();
 
 	/// Get the number of edges for this element.
-	size_t getNEdges() const { return 6; };
+	unsigned getNEdges() const { return 6; };
 	
 	/// Get the number of faces for this element.
-	size_t getNFaces() const { return 4; };
+	unsigned getNFaces() const { return 4; };
 
 	/// Get the number of neighbors for this element.
-	size_t getNNeighbors() const { return 4; };
+	unsigned getNNeighbors() const { return 4; };
 
 	/// Get the number of nodes for this element.
-	virtual size_t getNNodes() const { return 4; };
+	virtual unsigned getNNodes() const { return 4; };
 
 protected:
 	/// Constructor without nodes (for use of derived classes)
-	Tet(size_t value = 0);
+	Tet(unsigned value = 0);
 
 	/// Calculates the volume of a tetrahedron via the determinant of the matrix given by its four points.
 	double calcVolume();
diff --git a/MeshLib/Elements/Tet10.cpp b/MeshLib/Elements/Tet10.cpp
index 15c0abb5230392893e0eca396cc21348a13bfaec..c795668dc0e0582438f8aec616a59896df6cb56a 100644
--- a/MeshLib/Elements/Tet10.cpp
+++ b/MeshLib/Elements/Tet10.cpp
@@ -10,20 +10,20 @@
 
 namespace MeshLib {
 
-Tet10::Tet10(Node* nodes[10], size_t value)
+Tet10::Tet10(Node* nodes[10], unsigned value)
 	: Tet(value), FemElem()
 {
 	_nodes = nodes;
 	this->_volume = this->calcVolume();
-	this->calcCoG();
+	this->calcCentroid();
 }
 
 Tet10::Tet10(const Tet &tet)
 	: Tet(tet.getValue()), FemElem()
 {
 	_nodes = new Node*[10];
-	size_t nNodes (tet.getNNodes());
-	for (size_t i=0; i<nNodes; i++)
+	unsigned nNodes (tet.getNNodes());
+	for (unsigned i=0; i<nNodes; i++)
 		_nodes[i] = const_cast<Node*>(tet.getNode(i));
 
 	if (nNodes < this->getNNodes())
@@ -32,26 +32,26 @@ Tet10::Tet10(const Tet &tet)
 	}
 
 	this->_volume = this->calcVolume();
-	this->calcCoG();
+	this->calcCentroid();
 }
 
 Tet10::Tet10(const Tet10 &tet)
 	: Tet(tet.getValue()), FemElem()
 {
 	_nodes = new Node*[10];
-	for (size_t i=0; i<10; i++)
+	for (unsigned i=0; i<10; i++)
 		_nodes[i] = tet._nodes[i];
-	_centre_of_gravity = tet.getCentreOfGravity();
+	_centroid = tet.getCentroid();
 }
 
 Tet10::~Tet10()
 {
 }
 
-void Tet10::calcCoG()
+void Tet10::calcCentroid()
 {
 	//TODO calculation!
-	_centre_of_gravity = 0;
+	_centroid = 0;
 }
 
 }
diff --git a/MeshLib/Elements/Tet10.h b/MeshLib/Elements/Tet10.h
index e718e359209be74aaa162fca3859457fd92c2bc4..c82e535469218edac2d4ae70ffbcfa7e8380b633 100644
--- a/MeshLib/Elements/Tet10.h
+++ b/MeshLib/Elements/Tet10.h
@@ -42,7 +42,7 @@ class Tet10 : public Tet, public FemElem
 {
 public:
 	/// Constructor with an array of mesh nodes.
-	Tet10(Node* nodes[10], size_t value = 0);
+	Tet10(Node* nodes[10], unsigned value = 0);
 
 	/// Constructor using a simple Tetrahedron
 	Tet10(const Tet &tet);
@@ -54,11 +54,11 @@ public:
 	virtual ~Tet10();
 
 	/// Get the number of nodes for this element.
-	size_t getNNodes() const { return 10; };
+	unsigned getNNodes() const { return 10; };
 
 protected:
 	/// Calculates the volume of a tetrahedron via the determinant of the matrix given by its four points.
-	void calcCoG();
+	void calcCentroid();
 
 }; /* class */
 
diff --git a/MeshLib/Elements/Tet4.cpp b/MeshLib/Elements/Tet4.cpp
index 84d79b57360a74a19cebb23facaaae95039ccb7f..c759eebc8da2a15dd771e37a4ab0b41706962233 100644
--- a/MeshLib/Elements/Tet4.cpp
+++ b/MeshLib/Elements/Tet4.cpp
@@ -10,33 +10,33 @@
 
 namespace MeshLib {
 
-Tet4::Tet4(Node* nodes[4], size_t value)
+Tet4::Tet4(Node* nodes[4], unsigned value)
 	: Tet(nodes, value), FemElem()
 {
-	this->calcCoG();
+	this->calcCentroid();
 }
 
 Tet4::Tet4(const Tet &tet)
 	: Tet(tet), FemElem()
 {
-	this->calcCoG();
+	this->calcCentroid();
 }
 
 Tet4::Tet4(const Tet4 &tet)
 	: Tet(tet.getValue()), FemElem()
 {
-	for (size_t i=0; i<4; i++)
+	for (unsigned i=0; i<4; i++)
 		_nodes[i] = tet._nodes[i];
-	_centre_of_gravity = tet.getCentreOfGravity();
+	_centroid = tet.getCentroid();
 }
 
 Tet4::~Tet4()
 {
 }
 
-void Tet4::calcCoG()
+void Tet4::calcCentroid()
 {
-	_centre_of_gravity = 0;
+	_centroid = 0;
 	//TODO calculation!
 }
 
diff --git a/MeshLib/Elements/Tet4.h b/MeshLib/Elements/Tet4.h
index 3c31b5d7d77446813ccaf6e3ef01ec7f24aa4214..ceefe2da107fa33d3f684f76305ee94abb3e9839 100644
--- a/MeshLib/Elements/Tet4.h
+++ b/MeshLib/Elements/Tet4.h
@@ -35,10 +35,10 @@ class Tet4 : public Tet, public FemElem
 {
 public:
 	/// Constructor with an array of mesh nodes.
-	Tet4(Node* nodes[4], size_t value = 0);
+	Tet4(Node* nodes[4], unsigned value = 0);
 
 	/// Constructor using single mesh nodes.
-	Tet4(Node* n0, Node* n1, Node* n2, Node* n3, size_t value = 0);
+	Tet4(Node* n0, Node* n1, Node* n2, Node* n3, unsigned value = 0);
 
 	/// Constructor using a simple Tetrahedron
 	Tet4(const Tet &tet);
@@ -51,7 +51,7 @@ public:
 
 protected:
 	/// Calculates the volume of a tetrahedron via the determinant of the matrix given by its four points.
-	void calcCoG();
+	void calcCentroid();
 
 }; /* class */
 
diff --git a/MeshLib/Elements/Tri.cpp b/MeshLib/Elements/Tri.cpp
index a99e5a619393dd8f644eedf73db47026c35564a3..dde86a7170c4fd4e0eaa92611648f98b1e414563 100644
--- a/MeshLib/Elements/Tri.cpp
+++ b/MeshLib/Elements/Tri.cpp
@@ -12,17 +12,17 @@
 
 namespace MeshLib {
 
-Tri::Tri(Node* nodes[3], size_t value)
+Tri::Tri(Node* nodes[3], unsigned value)
 	: Face(MshElemType::TRIANGLE, value)
 {
 	_nodes = nodes;
 	_neighbors = new Element*[3];
-	for (size_t i=0; i<3; i++)
+	for (unsigned i=0; i<3; i++)
 		_neighbors[i] = NULL;
 	this->_area = this->calcArea();
 }
 
-Tri::Tri(Node* n0, Node* n1, Node* n2, size_t value)
+Tri::Tri(Node* n0, Node* n1, Node* n2, unsigned value)
 	: Face(MshElemType::TRIANGLE, value)
 {
 	_nodes = new Node*[3];
@@ -30,7 +30,7 @@ Tri::Tri(Node* n0, Node* n1, Node* n2, size_t value)
 	_nodes[1] = n1;
 	_nodes[2] = n2;
 	_neighbors = new Element*[3];
-	for (size_t i=0; i<3; i++)
+	for (unsigned i=0; i<3; i++)
 		_neighbors[i] = NULL;
 	this->_area = this->calcArea();
 }
@@ -40,7 +40,7 @@ Tri::Tri(const Tri &tri)
 {
 	_nodes = new Node*[3];
 	_neighbors = new Element*[3];
-	for (size_t i=0; i<3; i++)
+	for (unsigned i=0; i<3; i++)
 	{
 		_nodes[i] = tri._nodes[i];
 		_neighbors[i] = tri._neighbors[i];
@@ -54,7 +54,7 @@ Tri::~Tri()
 
 double Tri::calcArea()
 {
-	return MathLib::calcDetTriangle(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData());
+	return MathLib::calcTriangleArea(_nodes[0]->getData(), _nodes[1]->getData(), _nodes[2]->getData());
 }
 
 }
diff --git a/MeshLib/Elements/Tri.h b/MeshLib/Elements/Tri.h
index 4152eb8db375ac5ab8b2f84b5288ea95fe210176..37abfecfd2e51878353c462fd0feede69ca6fb91 100644
--- a/MeshLib/Elements/Tri.h
+++ b/MeshLib/Elements/Tri.h
@@ -32,10 +32,10 @@ class Tri : public Face
 {
 public:
 	/// Constructor with an array of mesh nodes.
-	Tri(Node* nodes[3], size_t value = 0);
+	Tri(Node* nodes[3], unsigned value = 0);
 
 	/// Constructor using single mesh nodes.
-	Tri(Node* n0, Node* n1, Node* n2, size_t value = 0);
+	Tri(Node* n0, Node* n1, Node* n2, unsigned value = 0);
 
 	/// Copy constructor
 	Tri(const Tri &tri);
@@ -44,13 +44,13 @@ public:
 	virtual ~Tri();
 
 	/// Get the number of edges for this element.
-	size_t getNEdges() const { return 3; };
+	unsigned getNEdges() const { return 3; };
 
 	/// Get the number of neighbors for this element.
-	size_t getNNeighbors() const { return 3; };
+	unsigned getNNeighbors() const { return 3; };
 
 	/// Get the number of nodes for this element.
-	virtual size_t getNNodes() const { return 3; };
+	virtual unsigned getNNodes() const { return 3; };
 
 protected:
 	/// Calculates the area of the triangle by returning half of the area of the corresponding parallelogram.
diff --git a/MeshLib/FemMesh.cpp b/MeshLib/FemMesh.cpp
index 490b788c097fd730e70a63cb5fdfebc7d773ace1..fa4b55d1464aa4f805e9026b5a5d4f2dd107d71e 100644
--- a/MeshLib/FemMesh.cpp
+++ b/MeshLib/FemMesh.cpp
@@ -12,7 +12,6 @@ namespace MeshLib {
 FemMesh::FemMesh(const std::string &name, const std::vector<Node*> &nodes, const std::vector<Element*> &elements)
 	: Mesh(name, nodes, elements)
 {
-	this->removeIdenticalNodes();
 }
 
 FemMesh::FemMesh(const Mesh &mesh)
diff --git a/MeshLib/FemNode.cpp b/MeshLib/FemNode.cpp
index 17ae4e5af242a9b8e4eeea62e8fe4aed43930298..fc82b38493c39cd9bafa54f8e9573d0259377e1f 100644
--- a/MeshLib/FemNode.cpp
+++ b/MeshLib/FemNode.cpp
@@ -9,12 +9,12 @@
 
 namespace MeshLib {
 
-FemNode::FemNode(double const*const coords, size_t id)
+FemNode::FemNode(double const*const coords, unsigned id)
 	: Node(coords, id)
 {
 }
 
-FemNode::FemNode(double x, double y, double z, size_t id)
+FemNode::FemNode(double x, double y, double z, unsigned id)
 	: Node(x, y, z, id)
 {
 }
diff --git a/MeshLib/FemNode.h b/MeshLib/FemNode.h
index 4a035df0817dd5325c4a45783411402e5291de05..6b49a4893080057c39743c71a959f38d6cd713dc 100644
--- a/MeshLib/FemNode.h
+++ b/MeshLib/FemNode.h
@@ -19,10 +19,10 @@ class FemNode : public Node
 {
 public:
 	/// Constructor using a coordinate array
-	FemNode(double const*const coords, size_t id = std::numeric_limits<size_t>::max());
+	FemNode(double const*const coords, unsigned id = std::numeric_limits<unsigned>::max());
 	
 	/// Constructor using single coordinates
-	FemNode(double x, double y, double z, size_t id = std::numeric_limits<size_t>::max());
+	FemNode(double x, double y, double z, unsigned id = std::numeric_limits<unsigned>::max());
 
 	/// Constructor using a mesh node
 	FemNode(const Node &node);
diff --git a/MeshLib/Mesh.cpp b/MeshLib/Mesh.cpp
index ec6043e35026ed91e8cb4ab241244e3dc720142c..fed2318fdf932d4b213a7c0043890bf5446d2879 100644
--- a/MeshLib/Mesh.cpp
+++ b/MeshLib/Mesh.cpp
@@ -20,7 +20,9 @@ namespace MeshLib {
 Mesh::Mesh(const std::string &name, const std::vector<Node*> &nodes, const std::vector<Element*> &elements)
 	: _name(name), _nodes(nodes), _elements(elements)
 {
-	this->removeIdenticalNodes();
+	this->makeNodesUnique();
+	this->setElementInformationForNodes();
+	this->setNeighborInformationForElements();
 }
 
 Mesh::Mesh(const Mesh &mesh)
@@ -31,7 +33,7 @@ Mesh::Mesh(const Mesh &mesh)
 Mesh::Mesh(const std::string &file_name)
 {
 	// read mesh
-	this->removeIdenticalNodes();
+	this->makeNodesUnique();
 }
 
 Mesh::~Mesh()
@@ -45,9 +47,22 @@ Mesh::~Mesh()
 		delete _nodes[i];
 }
 
-void Mesh::removeIdenticalNodes()
+void Mesh::makeNodesUnique()
 {
 	//check for unique mesh nodes
+	//PointVec::makePntsUnique
+	
+	//replace node pointers in elements
+	unsigned nElements (_elements.size());
+	for (unsigned i=0; i<nElements; i++)
+	{
+		unsigned nNodes (_elements[i]->getNNodes());
+		for (unsigned j=0; j<nNodes; j++)
+			_elements[i]->getNodeIndex(j);
+	}
+
+	//set correct id for each node
+	
 }
 
 void Mesh::addNode(Node* node)
@@ -60,11 +75,40 @@ void Mesh::addElement(Element* elem)
 	_elements.push_back(elem); 
 
 	// add element informatin to nodes
-	size_t nNodes (elem->getNNodes());
-	for (size_t i=0; i<nNodes; i++)
-		elem->getNode(i)->addElement(elem);
+	unsigned nNodes (elem->getNNodes());
+	for (unsigned i=0; i<nNodes; i++)
+		elem->_nodes[i]->addElement(elem);
 }
 
+void Mesh::setElementInformationForNodes()
+{
+	const size_t nElements (_elements.size());
+	for (unsigned i=0; i<nElements; i++)
+	{
+		const unsigned nNodes (_elements[i]->getNNodes());
+		for (unsigned j=0; j<nNodes; j++)
+			_elements[i]->_nodes[j]->addElement(_elements[i]);
+	}
+}
+
+void Mesh::setNeighborInformationForElements()
+{
+	/* TODO
+	const size_t nElements(_elements.size());
+	std::vector<std::vector<char>> nb (nElements, std::vector<char>(nElements));
+
+	for (unsigned i=0; i<nElements; i++)
+	{
+		Element* elem = _elements[i];
+		const size_t nNodes (elem->getNNodes());
+		for (unsigned j=0; j<nNodes; j++)
+		{
+			const Node* node = elem->getNode(j);
+			
+		}
+	}
+	*/
+}
 
 }
 
diff --git a/MeshLib/Mesh.h b/MeshLib/Mesh.h
index 3c5b61f7df09823cb36104bc3be6db15dd5ecd7c..8f71750c76638f47bce2f63ee3292bc39e9f67de 100644
--- a/MeshLib/Mesh.h
+++ b/MeshLib/Mesh.h
@@ -12,16 +12,18 @@
 #include <string>
 #include <vector>
 
-namespace MeshLib {
 
-class Node;
-class Element;
+namespace MeshLib 
+{
+	class Node;
+	class Element;
 
 /**
  * A basic mesh.
  */
 class Mesh
 {
+
 public:
 	/// Constructor using a mesh name and an array of nodes and elements
 	Mesh(const std::string &name, const std::vector<Node*> &nodes, const std::vector<Element*> &elements);
@@ -42,10 +44,10 @@ public:
 	void addElement(Element* elem);
 
 	/// Get the node with the given index.
-	const Node* getNode(size_t idx) const { return _nodes[idx]; };
+	const Node* getNode(unsigned idx) const { return _nodes[idx]; };
 
 	/// Get the element with the given index.
-	const Element* getElement(size_t idx) const { return _elements[idx]; };
+	const Element* getElement(unsigned idx) const { return _elements[idx]; };
 
 	/// Get the number of elements
 	size_t getNElements() const { return _elements.size(); };
@@ -61,10 +63,16 @@ public:
 
 	/// Get the element-vector for the mesh.
 	const std::vector<Element*> getElements() const { return _elements; };
-
+	
 protected:
 	/// Checks the coordinates of all mesh nodes and removes identical nodes. Elements are adapted accordingly.
-	void removeIdenticalNodes();
+	void makeNodesUnique();
+
+	/// Fills in the neighbor-information for nodes (i.e. which element each node belongs to).
+	void setElementInformationForNodes();
+
+	/// Fills in the neighbor-information for elements.
+	void setNeighborInformationForElements();
 
 	std::string _name;
 	std::vector<Node*> _nodes;
diff --git a/MeshLib/Node.cpp b/MeshLib/Node.cpp
index 8e3030bde23835afd40654747de19009c01afa01..c300b2c3f091439836e13be4ca0149fd9dbfb3ad 100644
--- a/MeshLib/Node.cpp
+++ b/MeshLib/Node.cpp
@@ -9,12 +9,12 @@
 
 namespace MeshLib {
 
-Node::Node(const double coords[3], size_t id)
+Node::Node(const double coords[3], unsigned id)
 	: GEOLIB::PointWithID(coords, id)
 {
 }
 
-Node::Node(double x, double y, double z, size_t id)
+Node::Node(double x, double y, double z, unsigned id)
 	: GEOLIB::PointWithID(x, y, z, id)
 {
 }
diff --git a/MeshLib/Node.h b/MeshLib/Node.h
index a73b01d01ce153466a1b2685083d8af8f0fbb6cc..f2bcec99569f9c835f16fd50018da59d0a9e832c 100644
--- a/MeshLib/Node.h
+++ b/MeshLib/Node.h
@@ -24,18 +24,23 @@ class Element;
  */
 class Node : public GEOLIB::PointWithID
 {
+	/* friend functions: */
+	friend void Mesh::setElementInformationForNodes();
+	friend void Mesh::addElement(Element*);
+	
+
 public:
 	/// Constructor using a coordinate array
-	Node(const double coords[3], size_t id = std::numeric_limits<size_t>::max());
+	Node(const double coords[3], unsigned id = std::numeric_limits<unsigned>::max());
 
 	/// Constructor using single coordinates
-	Node(double x, double y, double z, size_t id = std::numeric_limits<size_t>::max());
+	Node(double x, double y, double z, unsigned id = std::numeric_limits<unsigned>::max());
 
 	/// Copy constructor
 	Node(const Node &node);
 
 	/// Get an element the node is part of.
-	const Element* getElement(size_t idx) const { return _elements[idx]; };
+	const Element* getElement(unsigned idx) const { return _elements[idx]; };
 
 	/// Get all elements the node is part of.
 	const std::vector<const Element*> getElements() const { return _elements; };
@@ -55,10 +60,6 @@ protected:
 
 	std::vector<const Element*> _elements;
 
-/* friend functions: */
-	friend void Mesh::addElement(Element*);
-	//friend void Mesh::removeElement(size_t);
-
 }; /* class */
 
 } /* namespace */