diff --git a/FileIO/Legacy/OGSIOVer4.cpp b/FileIO/Legacy/OGSIOVer4.cpp
index 121783164103e34001e45bb29eaeec6ce10f6e1d..463bbb4ac784b1b37459a50fa2435d1f5827bd1d 100644
--- a/FileIO/Legacy/OGSIOVer4.cpp
+++ b/FileIO/Legacy/OGSIOVer4.cpp
@@ -56,10 +56,10 @@ namespace FileIO
 /** reads the points inclusive their names from input stream in
  * using the OGS-4 file format */
 std::string readPoints(std::istream &in, std::vector<Point*>* pnt_vec,
-                       bool &zero_based_indexing, std::map<std::string,size_t>* pnt_id_name_map)
+                       bool &zero_based_indexing, std::map<std::string,std::size_t>* pnt_id_name_map)
 {
 	std::string line;
-	size_t cnt(0);
+	std::size_t cnt(0);
 
 	getline(in, line);
 	// geometric key words start with the hash #
@@ -68,7 +68,7 @@ std::string readPoints(std::istream &in, std::vector<Point*>* pnt_vec,
 	{
 		// read id and point coordinates
 		std::stringstream inss(line);
-		size_t id;
+		std::size_t id;
 		double x, y, z;
 		inss >> id >> x >> y >> z;
 		if (!inss.fail ())
@@ -86,23 +86,23 @@ std::string readPoints(std::istream &in, std::vector<Point*>* pnt_vec,
 			if (line.find("$MD") != std::string::npos)
 			{
 				double mesh_density;
-				size_t pos1(line.find_first_of("M"));
+				std::size_t pos1(line.find_first_of("M"));
 				inss.str(line.substr(pos1 + 2, std::string::npos));
 				inss >> mesh_density;
 			}
 
 			// read name of point
-			size_t pos (line.find("$NAME"));
+			std::size_t pos (line.find("$NAME"));
 			if (pos != std::string::npos) //OK
 			{
-				size_t end_pos ((line.substr (pos + 6)).find(" "));
+				std::size_t end_pos ((line.substr (pos + 6)).find(" "));
 				if (end_pos != std::string::npos)
 					(*pnt_id_name_map)[line.substr (pos + 6, end_pos)] = id;
 				else
 					(*pnt_id_name_map)[line.substr (pos + 6)] = id;
 			}
 
-			size_t id_pos (line.find("$ID"));
+			std::size_t id_pos (line.find("$ID"));
 			if (id_pos != std::string::npos)
 				WARN("readPoints(): found tag $ID - please use tag $NAME for reading point names in point %d.", cnt);
 			cnt++;
@@ -132,7 +132,7 @@ void readPolylinePointVector(const std::string &fname,
 	while (in)
 	{
 		in >> x >> y >> z;
-		size_t pnt_id(pnt_vec.size());
+		std::size_t pnt_id(pnt_vec.size());
 		pnt_vec.push_back(new Point(x, y, z));
 		ply->addPoint(pnt_id);
 	}
@@ -152,16 +152,16 @@ void readPolylinePointVector(const std::string &fname,
 /** read a single Polyline from stream in into the ply_vec-vector */
 std::string readPolyline(std::istream &in,
                          std::vector<GeoLib::Polyline*>* ply_vec,
-                         std::map<std::string,size_t>& ply_vec_names,
-                         std::vector<Point*>& pnt_vec,
+                         std::map<std::string,std::size_t>& ply_vec_names,
+                         std::vector<Point*> & pnt_vec,
                          bool zero_based_indexing,
-                         const std::vector<size_t>& pnt_id_map,
+                         const std::vector<std::size_t>& pnt_id_map,
                          const std::string &path,
                          std::vector<std::string> &errors)
 {
 	std::string line, name_of_ply;
 	GeoLib::Polyline* ply(new GeoLib::Polyline(pnt_vec));
-	size_t type = 2; // need an initial value
+	std::size_t type = 2; // need an initial value
 
 	// Schleife ueber alle Phasen bzw. Komponenten
 	do {
@@ -179,7 +179,7 @@ std::string readPolyline(std::istream &in,
 		if (line.find("$TYPE") != std::string::npos) // subkeyword found
 		{
 			in >> line; // read value
-			type = static_cast<size_t> (strtol(line.c_str(), NULL, 0));
+			type = static_cast<std::size_t> (strtol(line.c_str(), NULL, 0));
 		}
 		//....................................................................
 		if (line.find("$EPSILON") != std::string::npos) // subkeyword found
@@ -196,10 +196,10 @@ std::string readPolyline(std::istream &in,
 				       && (line.find("#") == std::string::npos)
 				       && (line.find("$") == std::string::npos))
 				{
-					size_t pnt_id(BaseLib::str2number<size_t> (line));
+					std::size_t pnt_id(BaseLib::str2number<std::size_t> (line));
 					if (!zero_based_indexing)
 						pnt_id--;  // one based indexing
-					size_t ply_size (ply->getNumberOfPoints());
+					std::size_t ply_size (ply->getNumberOfPoints());
 					if (ply_size > 0)
 					{
 						if (ply->getPointID (ply_size - 1) != pnt_id_map[pnt_id])
@@ -226,7 +226,7 @@ std::string readPolyline(std::istream &in,
 
 	if (type != 100)
 	{
-		ply_vec_names.insert (std::pair<std::string,size_t>(name_of_ply, ply_vec->size()));
+		ply_vec_names.insert (std::pair<std::string,std::size_t>(name_of_ply, ply_vec->size()));
 		ply_vec->push_back(ply);
 	}
 
@@ -247,8 +247,9 @@ std::string readPolyline(std::istream &in,
 **************************************************************************/
 /** reads polylines */
 std::string readPolylines(std::istream &in, std::vector<GeoLib::Polyline*>* ply_vec,
-                          std::map<std::string,size_t>& ply_vec_names, std::vector<Point*>& pnt_vec,
-                          bool zero_based_indexing, const std::vector<size_t>& pnt_id_map,
+                          std::map<std::string,std::size_t>& ply_vec_names,
+                          std::vector<Point*> & pnt_vec,
+                          bool zero_based_indexing, const std::vector<std::size_t>& pnt_id_map,
                           const std::string &path, std::vector<std::string>& errors)
 {
 	if (!in) {
@@ -275,14 +276,14 @@ void readTINFile(const std::string &fname, Surface* sfc,
 		return;
 	}
 
-	size_t id;
+	std::size_t id;
 	double x, y, z;
 	while (in)
 	{
 		// read id
 		in >> id;
 		// determine size
-		size_t pnt_pos(pnt_vec.size());
+		std::size_t pnt_pos(pnt_vec.size());
 		// read first point
 		in >> x >> y >> z;
 		pnt_vec.push_back(new Point(x, y, z));
@@ -310,9 +311,9 @@ void readTINFile(const std::string &fname, Surface* sfc,
 std::string readSurface(std::istream &in,
                         std::vector<GeoLib::Polygon*> &polygon_vec,
                         std::vector<Surface*> &sfc_vec,
-                        std::map<std::string,size_t>& sfc_names,
+                        std::map<std::string,std::size_t>& sfc_names,
                         const std::vector<GeoLib::Polyline*> &ply_vec,
-                        const std::map<std::string, size_t>& ply_vec_names,
+                        const std::map<std::string, std::size_t>& ply_vec_names,
                         std::vector<Point*> &pnt_vec,
                         std::string const& path, std::vector<std::string>& errors)
 {
@@ -321,7 +322,7 @@ std::string readSurface(std::istream &in,
 
 	int type (-1);
 	std::string name;
-	size_t ply_id (0); // std::numeric_limits<size_t>::max());
+	std::size_t ply_id (0); // std::numeric_limits<std::size_t>::max());
 
 	do {
 		in >> line;
@@ -368,7 +369,7 @@ std::string readSurface(std::istream &in,
 			       && (line.find("$") == std::string::npos))
 			{
 				// we did read the name of a polyline -> search the id for polyline
-				std::map<std::string,size_t>::const_iterator it (ply_vec_names.find (
+				std::map<std::string,std::size_t>::const_iterator it (ply_vec_names.find (
 				                                                         line));
 				if (it != ply_vec_names.end())
 					ply_id = it->second;
@@ -395,7 +396,7 @@ std::string readSurface(std::istream &in,
 	} while (line.find("#") == std::string::npos && line.size() != 0 && in);
 
 	if (!name.empty())
-		sfc_names.insert(std::pair<std::string,size_t>(name,sfc_vec.size()));
+		sfc_names.insert(std::pair<std::string,std::size_t>(name,sfc_vec.size()));
 
 	if (sfc)
 		// surface create by TIN
@@ -403,7 +404,7 @@ std::string readSurface(std::istream &in,
 	else
     {
         // surface created by polygon
-        if (ply_id != std::numeric_limits<size_t>::max() && ply_id != ply_vec.size())
+        if (ply_id != std::numeric_limits<std::size_t>::max() && ply_id != ply_vec.size())
         {
             if (ply_vec[ply_id]->isClosed())
             {
@@ -429,9 +430,9 @@ std::string readSurface(std::istream &in,
 **************************************************************************/
 std::string readSurfaces(std::istream &in,
                          std::vector<Surface*> &sfc_vec,
-                         std::map<std::string, size_t>& sfc_names,
+                         std::map<std::string, std::size_t>& sfc_names,
                          const std::vector<GeoLib::Polyline*> &ply_vec,
-                         const std::map<std::string,size_t>& ply_vec_names,
+                         const std::map<std::string,std::size_t>& ply_vec_names,
                          std::vector<Point*> &pnt_vec,
                          const std::string &path, std::vector<std::string>& errors)
 {
@@ -446,7 +447,7 @@ std::string readSurfaces(std::istream &in,
 
 	while (!in.eof() && tag.find("#SURFACE") != std::string::npos)
 	{
-		size_t n_polygons (polygon_vec.size());
+		std::size_t n_polygons (polygon_vec.size());
 		tag = readSurface(in,
 		                  polygon_vec,
 		                  sfc_vec,
@@ -468,7 +469,7 @@ std::string readSurfaces(std::istream &in,
 			sfc_vec.push_back(sfc);
 		}
 	}
-	for (size_t k(0); k < polygon_vec.size(); k++)
+	for (std::size_t k(0); k < polygon_vec.size(); k++)
 		delete polygon_vec[k];
 
 	return tag;
@@ -493,7 +494,7 @@ bool readGLIFileV4(const std::string& fname,
 		getline (in, tag);
 
 	// read names of points into vector of strings
-	std::map<std::string,size_t>* pnt_id_names_map (new std::map<std::string,size_t>);
+	std::map<std::string,std::size_t>* pnt_id_names_map (new std::map<std::string,std::size_t>);
 	bool zero_based_idx(true);
 	std::vector<Point*>* pnt_vec(new std::vector<Point*>);
 	INFO("GeoLib::readGLIFile(): read points from stream.");
@@ -508,21 +509,22 @@ bool readGLIFileV4(const std::string& fname,
 	const std::string path = BaseLib::extractPath(fname);
 
 	// read names of plys into temporary string-vec
-	std::map<std::string,size_t>* ply_names (new std::map<std::string,size_t>);
+	std::map<std::string,std::size_t>* ply_names (new std::map<std::string,std::size_t>);
 	std::vector<GeoLib::Polyline*>* ply_vec(new std::vector<GeoLib::Polyline*>);
+	std::vector<Point*>* geo_pnt_vec(const_cast<std::vector<Point*>*>(geo->getPointVec(unique_name)));
 	if (tag.find("#POLYLINE") != std::string::npos && in)
 	{
 		INFO("GeoLib::readGLIFile(): read polylines from stream.");
-		tag = readPolylines(in, ply_vec, *ply_names, *pnt_vec,
-		                    zero_based_idx, geo->getPointVecObj(
-		                            unique_name)->getIDMap(), path, errors);
+		tag = readPolylines(in, ply_vec, *ply_names, *geo_pnt_vec,
+		                    zero_based_idx,
+		                    geo->getPointVecObj(unique_name)->getIDMap(), path, errors);
 		INFO("GeoLib::readGLIFile(): \t ok, %d polylines read.", ply_vec->size());
 	}
 	else
 		INFO("GeoLib::readGLIFile(): tag #POLYLINE not found.");
 
 	std::vector<Surface*>* sfc_vec(new std::vector<Surface*>);
-	std::map<std::string,size_t>* sfc_names (new std::map<std::string,size_t>);
+	std::map<std::string,std::size_t>* sfc_names (new std::map<std::string,std::size_t>);
 	if (tag.find("#SURFACE") != std::string::npos && in)
 	{
 		INFO("GeoLib::readGLIFile(): read surfaces from stream.");
@@ -565,11 +567,11 @@ void writeGLIFileV4 (const std::string& fname,
 	std::ofstream os (fname.c_str());
 	if (pnts) {
 		std::string pnt_name;
-		const size_t n_pnts(pnts->size());
+		const std::size_t n_pnts(pnts->size());
 		INFO("GeoLib::writeGLIFileV4(): writing %d points to file %s.", n_pnts, fname.c_str());
 		os << "#POINTS" << "\n";
 		os.precision (20);
-		for (size_t k(0); k < n_pnts; k++) {
+		for (std::size_t k(0); k < n_pnts; k++) {
 			os << k << " " << *((*pnts)[k]);
 			if (pnt_vec->getNameOfElementByID(k, pnt_name)) {
 				os << " $NAME " << pnt_name;
@@ -584,14 +586,14 @@ void writeGLIFileV4 (const std::string& fname,
 		const std::vector<GeoLib::Polyline*>* plys (plys_vec->getVector());
 		INFO("GeoLib::writeGLIFileV4(): %d polylines to file %s.",
 		     plys->size (), fname.c_str());
-		for (size_t k(0); k < plys->size(); k++)
+		for (std::size_t k(0); k < plys->size(); k++)
 		{
 			os << "#POLYLINE" << "\n";
 			std::string polyline_name;
 			plys_vec->getNameOfElement((*plys)[k], polyline_name);
 			os << " $NAME " << "\n" << "  " << polyline_name << "\n";
 			os << " $POINTS" << "\n";
-			for (size_t j(0); j < (*plys)[k]->getNumberOfPoints(); j++)
+			for (std::size_t j(0); j < (*plys)[k]->getNumberOfPoints(); j++)
 				os << "  " << ((*plys)[k])->getPointID(j) << "\n";
 		}
 	}
@@ -601,7 +603,7 @@ void writeGLIFileV4 (const std::string& fname,
 		const std::vector<GeoLib::Polyline*>* plys(plys_vec->getVector());
 		INFO("GeoLib::writeGLIFileV4(): write closed polylines as surfaces to file %s.",
 		     fname.c_str());
-		for (size_t k(0); k < plys->size(); k++)
+		for (std::size_t k(0); k < plys->size(); k++)
 			if ((*plys)[k]->isClosed())
 			{
 				os << "#SURFACE" << "\n";
@@ -625,21 +627,21 @@ void writeAllDataToGLIFileV4 (const std::string& fname, const GeoLib::GEOObjects
 
 	std::ofstream os (fname.c_str());
 
-	size_t pnts_offset (0);
-	std::vector<size_t> pnts_id_offset;
+	std::size_t pnts_offset (0);
+	std::vector<std::size_t> pnts_id_offset;
 	pnts_id_offset.push_back (0);
 
 	// writing all points
 	os << "#POINTS" << "\n";
-	for (size_t j(0); j < geo_names.size(); j++)
+	for (std::size_t j(0); j < geo_names.size(); j++)
 	{
 		os.precision (20);
 		GeoLib::PointVec const* const pnt_vec(geo.getPointVecObj(geo_names[j]));
 		std::vector<GeoLib::Point*> const* const pnts (pnt_vec->getVector());
 		if (pnts) {
 			std::string pnt_name;
-			const size_t n_pnts(pnts->size());
-			for (size_t k(0); k < n_pnts; k++) {
+			const std::size_t n_pnts(pnts->size());
+			for (std::size_t k(0); k < n_pnts; k++) {
 				os << pnts_offset + k << " " << *((*pnts)[k]);
 				if (pnt_vec->getNameOfElementByID(k, pnt_name)) {
 					os << " $NAME " << pnt_name;
@@ -656,13 +658,13 @@ void writeAllDataToGLIFileV4 (const std::string& fname, const GeoLib::GEOObjects
 	// writing all stations
 	std::vector<std::string> stn_names;
 	geo.getStationVectorNames (stn_names);
-	for (size_t j(0); j < stn_names.size(); j++)
+	for (std::size_t j(0); j < stn_names.size(); j++)
 	{
 		os.precision (20);
 		const std::vector<GeoLib::Point*>* pnts (geo.getStationVec(stn_names[j]));
 		if (pnts)
 		{
-			for (size_t k(0); k < pnts->size(); k++)
+			for (std::size_t k(0); k < pnts->size(); k++)
 				os << k + pnts_offset << " " << *((*pnts)[k]) << " $NAME " <<
 				static_cast<GeoLib::Station*>((*pnts)[k])->getName() << "\n";
 			pnts_offset += pnts->size();
@@ -670,15 +672,15 @@ void writeAllDataToGLIFileV4 (const std::string& fname, const GeoLib::GEOObjects
 		}
 	}
 
-	size_t plys_cnt (0);
+	std::size_t plys_cnt (0);
 
 	// writing all polylines
-	for (size_t j(0); j < geo_names.size(); j++)
+	for (std::size_t j(0); j < geo_names.size(); j++)
 	{
 		const GeoLib::PolylineVec* plys_vec (geo.getPolylineVecObj (geo_names[j]));
 		if (plys_vec) {
 			const std::vector<GeoLib::Polyline*>* plys (plys_vec->getVector());
-			for (size_t k(0); k < plys->size(); k++) {
+			for (std::size_t k(0); k < plys->size(); k++) {
 				os << "#POLYLINE" << "\n";
 				std::string ply_name;
 				if (plys_vec->getNameOfElementByID (plys_cnt, ply_name))
@@ -688,7 +690,7 @@ void writeAllDataToGLIFileV4 (const std::string& fname, const GeoLib::GEOObjects
 					os << "\t$NAME " << "\n" << "\t\t" << geo_names[j] <<
 					"-" << plys_cnt << "\n";
 				os << "\t$POINTS" << "\n";
-				for (size_t l(0); l < (*plys)[k]->getNumberOfPoints(); l++)
+				for (std::size_t l(0); l < (*plys)[k]->getNumberOfPoints(); l++)
 					os << "\t\t" << pnts_id_offset[j] +
 					((*plys)[k])->getPointID(l) << "\n";
 				plys_cnt++;
@@ -697,13 +699,13 @@ void writeAllDataToGLIFileV4 (const std::string& fname, const GeoLib::GEOObjects
 	}
 
 	// writing surfaces as TIN files
-	size_t sfcs_cnt (0);
-	for (size_t j(0); j < geo_names.size(); j++)
+	std::size_t sfcs_cnt (0);
+	for (std::size_t j(0); j < geo_names.size(); j++)
 	{
 		const GeoLib::SurfaceVec* sfcs_vec (geo.getSurfaceVecObj (geo_names[j]));
 			if (sfcs_vec) {
 				const std::vector<GeoLib::Surface*>* sfcs (sfcs_vec->getVector());
-				for (size_t k(0); k < sfcs->size(); k++)
+				for (std::size_t k(0); k < sfcs->size(); k++)
 				{
 					os << "#SURFACE" << "\n";
 					std::string sfc_name(path);
@@ -719,8 +721,8 @@ void writeAllDataToGLIFileV4 (const std::string& fname, const GeoLib::GEOObjects
 				// create tin file
 				std::ofstream tin_os (sfc_name.c_str());
 				GeoLib::Surface const& sfc (*(*sfcs)[k]);
-				const size_t n_tris (sfc.getNTriangles());
-					for (size_t l(0); l < n_tris; l++) {
+				const std::size_t n_tris (sfc.getNTriangles());
+					for (std::size_t l(0); l < n_tris; l++) {
 						GeoLib::Triangle const& tri (*(sfc[l]));
 					tin_os << l << " " << *(tri.getPoint(0)) << " " <<
 					*(tri.getPoint(1)) << " " << *(tri.getPoint(2)) <<
diff --git a/GeoLib/PointVec.cpp b/GeoLib/PointVec.cpp
index 67ab69db48459971998af6d0ed4c7a263f918f66..f60701abbc124c3db259cd506953e6510f2579b2 100644
--- a/GeoLib/PointVec.cpp
+++ b/GeoLib/PointVec.cpp
@@ -29,25 +29,26 @@
 namespace GeoLib
 {
 PointVec::PointVec (const std::string& name, std::vector<Point*>* points,
-                    std::map<std::string, size_t>* name_id_map, PointType type, double rel_eps) :
+                    std::map<std::string, std::size_t>* name_id_map, PointType type, double rel_eps) :
 	TemplateVec<Point> (name, points, name_id_map),
 	_type(type), _sqr_shortest_dist (std::numeric_limits<double>::max()),
 	_aabb(points->begin(), points->end())
 {
 	assert (_data_vec);
-	size_t number_of_all_input_pnts (_data_vec->size());
+	std::size_t number_of_all_input_pnts (_data_vec->size());
 
 	rel_eps *= sqrt(MathLib::sqrDist (&(_aabb.getMinPoint()),&(_aabb.getMaxPoint())));
 	makePntsUnique (_data_vec, _pnt_id_map, rel_eps);
 
 	if (number_of_all_input_pnts - _data_vec->size() > 0)
-		WARN("PointVec::PointVec(): there are %d double points.", number_of_all_input_pnts - _data_vec->size());
+		WARN("PointVec::PointVec(): there are %d double points.",
+		     number_of_all_input_pnts - _data_vec->size());
 }
 
 PointVec::~PointVec ()
 {}
 
-size_t PointVec::push_back (Point* pnt)
+std::size_t PointVec::push_back (Point* pnt)
 {
 	_pnt_id_map.push_back (uniqueInsert(pnt));
 	return _pnt_id_map[_pnt_id_map.size() - 1];
@@ -60,20 +61,20 @@ void PointVec::push_back (Point* pnt, std::string const*const name)
 		return;
 	}
 
-	std::map<std::string,size_t>::const_iterator it (_name_id_map->find (*name));
+	std::map<std::string,std::size_t>::const_iterator it (_name_id_map->find (*name));
 	if (it != _name_id_map->end()) {
 		WARN("PointVec::push_back(): two points share the name %s.", name->c_str());
 		return;
 	}
 
-	size_t id (uniqueInsert (pnt));
+	std::size_t id (uniqueInsert (pnt));
 	_pnt_id_map.push_back (id);
 	(*_name_id_map)[*name] = id;
 }
 
-size_t PointVec::uniqueInsert (Point* pnt)
+std::size_t PointVec::uniqueInsert (Point* pnt)
 {
-	size_t n (_data_vec->size()), k;
+	std::size_t n (_data_vec->size()), k;
 	const double eps (std::numeric_limits<double>::epsilon());
 	for (k = 0; k < n; k++)
 		if (fabs((*((*_data_vec)[k]))[0] - (*pnt)[0]) < eps
@@ -86,7 +87,7 @@ size_t PointVec::uniqueInsert (Point* pnt)
 		// update bounding box
 		_aabb.update (*((*_data_vec)[n]));
 		// update shortest distance
-		for (size_t i(0); i < n; i++) {
+		for (std::size_t i(0); i < n; i++) {
 			double sqr_dist (MathLib::sqrDist((*_data_vec)[i], (*_data_vec)[n]));
 			if (sqr_dist < _sqr_shortest_dist)
 				_sqr_shortest_dist = sqr_dist;
@@ -102,8 +103,8 @@ size_t PointVec::uniqueInsert (Point* pnt)
 std::vector<Point*>* PointVec::filterStations(const std::vector<PropertyBounds> &bounds) const
 {
 	std::vector<Point*>* tmpStations (new std::vector<Point*>);
-	size_t size (_data_vec->size());
-	for (size_t i = 0; i < size; i++)
+	std::size_t size (_data_vec->size());
+	for (std::size_t i = 0; i < size; i++)
 		if (static_cast<Station*>((*_data_vec)[i])->inSelection(bounds))
 			tmpStations->push_back((*_data_vec)[i]);
 	return tmpStations;
@@ -114,128 +115,107 @@ double PointVec::getShortestPointDistance () const
 	return sqrt (_sqr_shortest_dist);
 }
 
-void PointVec::makePntsUnique (std::vector<GeoLib::Point*>* pnt_vec,
-                               std::vector<size_t> &pnt_id_map, double eps)
+void PointVec::makePntsUnique (std::vector<GeoLib::Point*> *& pnt_vec,
+                               std::vector<std::size_t> &pnt_id_map, double eps)
 {
-	size_t n_pnts_in_file (pnt_vec->size());
-	std::vector<size_t> perm;
-	pnt_id_map.reserve (n_pnts_in_file);
-	for (size_t k(0); k < n_pnts_in_file; k++)
-	{
-		perm.push_back (k);
+	std::size_t n_pnts_in_file(pnt_vec->size());
+	std::vector<std::size_t> perm;
+	pnt_id_map.reserve(n_pnts_in_file);
+	for (std::size_t k(0); k < n_pnts_in_file; k++) {
+		perm.push_back(k);
 		pnt_id_map.push_back(k);
 	}
 
 	// sort the points
-	BaseLib::Quicksort<GeoLib::Point*> (*pnt_vec, 0, n_pnts_in_file, perm);
+	BaseLib::Quicksort<GeoLib::Point*>(*pnt_vec, 0, n_pnts_in_file, perm);
 
 	// unfortunately quicksort is not stable -
 	// sort identical points by id - to make sorting stable
 	// determine intervals with identical points to resort for stability of sorting
-	std::vector<size_t> identical_pnts_interval;
-	bool identical (false);
-	for (size_t k = 0; k < n_pnts_in_file - 1; k++)
-	{
-		if ( fabs((*((*pnt_vec)[k + 1]))[0] - (*((*pnt_vec)[k]))[0]) < eps
-		     &&  fabs( (*((*pnt_vec)[k + 1]))[1] - (*((*pnt_vec)[k]))[1]) < eps
-		     &&  fabs( (*((*pnt_vec)[k + 1]))[2] - (*((*pnt_vec)[k]))[2]) < eps)
-		{
+	std::vector<std::size_t> identical_pnts_interval;
+	bool identical(false);
+	for (std::size_t k = 0; k < n_pnts_in_file - 1; k++) {
+		if (fabs((*((*pnt_vec)[k + 1]))[0] - (*((*pnt_vec)[k]))[0]) < eps
+				&& fabs((*((*pnt_vec)[k + 1]))[1] - (*((*pnt_vec)[k]))[1]) < eps
+				&& fabs((*((*pnt_vec)[k + 1]))[2] - (*((*pnt_vec)[k]))[2]) < eps) {
 			// points are identical, sort by id
 			if (!identical)
-				identical_pnts_interval.push_back (k);
+				identical_pnts_interval.push_back(k);
 			identical = true;
-		}
-		else
-		{
+		} else {
 			if (identical)
-				identical_pnts_interval.push_back (k + 1);
+				identical_pnts_interval.push_back(k + 1);
 			identical = false;
 		}
 	}
 	if (identical)
-		identical_pnts_interval.push_back (n_pnts_in_file);
+		identical_pnts_interval.push_back(n_pnts_in_file);
 
-	for (size_t i(0); i < identical_pnts_interval.size() / 2; i++)
-	{
+	for (std::size_t i(0); i < identical_pnts_interval.size() / 2; i++) {
 		// bubble sort by id
-		size_t beg (identical_pnts_interval[2 * i]);
-		size_t end (identical_pnts_interval[2 * i + 1]);
-		for (size_t j (beg); j < end; j++)
-			for (size_t k (beg); k < end - 1; k++)
+		std::size_t beg(identical_pnts_interval[2 * i]);
+		std::size_t end(identical_pnts_interval[2 * i + 1]);
+		for (std::size_t j(beg); j < end; j++)
+			for (std::size_t k(beg); k < end - 1; k++)
 				if (perm[k] > perm[k + 1])
-					std::swap (perm[k], perm[k + 1]);
+					std::swap(perm[k], perm[k + 1]);
 
 	}
 
 	// check if there are identical points
-	for (size_t k = 0; k < n_pnts_in_file - 1; k++)
-		if ( fabs((*((*pnt_vec)[k + 1]))[0] - (*((*pnt_vec)[k]))[0]) < eps
-		     &&  fabs( (*((*pnt_vec)[k + 1]))[1] - (*((*pnt_vec)[k]))[1]) < eps
-		     &&  fabs( (*((*pnt_vec)[k + 1]))[2] - (*((*pnt_vec)[k]))[2]) < eps)
+	for (std::size_t k = 0; k < n_pnts_in_file - 1; k++) {
+		if (fabs((*((*pnt_vec)[k + 1]))[0] - (*((*pnt_vec)[k]))[0]) < eps
+				&& fabs((*((*pnt_vec)[k + 1]))[1] - (*((*pnt_vec)[k]))[1]) < eps
+				&& fabs((*((*pnt_vec)[k + 1]))[2] - (*((*pnt_vec)[k]))[2]) < eps) {
 			pnt_id_map[perm[k + 1]] = pnt_id_map[perm[k]];
+		}
+	}
 
 	// reverse permutation
-	BaseLib::Quicksort<std::size_t, GeoLib::Point*> (perm, 0, n_pnts_in_file, *pnt_vec);
+	BaseLib::Quicksort<std::size_t, GeoLib::Point*>(perm, 0, n_pnts_in_file, *pnt_vec);
 
 	// remove the second, third, ... occurrence from vector
-	for (size_t k(0); k < n_pnts_in_file; k++)
-		if (pnt_id_map[k] < k)
-		{
+	std::size_t cnt(0); // counts the points that are deleted
+	for (std::size_t k(0); k < n_pnts_in_file; k++) {
+		if (pnt_id_map[k] < k) {
 			delete (*pnt_vec)[k];
-			(*pnt_vec)[k] = NULL;
+			(*pnt_vec)[k] = nullptr;
+			cnt++;
 		}
-	// remove NULL-ptr from vector
-	for (std::vector<GeoLib::Point*>::iterator it(pnt_vec->begin()); it != pnt_vec->end(); )
-	{
-		if (*it == NULL)
-			it = pnt_vec->erase (it);
-		else
-			it++;
 	}
 
+	std::vector<GeoLib::Point*>* tmp_pnt_vec(new std::vector<GeoLib::Point*>(n_pnts_in_file - cnt));
+	std::remove_copy(pnt_vec->begin(), pnt_vec->end(), tmp_pnt_vec->begin(), nullptr);
+	std::swap(tmp_pnt_vec, pnt_vec);
+	delete tmp_pnt_vec;
+
 	// renumber id-mapping
-	size_t cnt (0);
-	for (size_t k(0); k < n_pnts_in_file; k++)
-	{
-		if (pnt_id_map[k] == k) // point not removed, if necessary: id change
-		{
+	cnt = 0;
+	for (std::size_t k(0); k < n_pnts_in_file; k++) {
+		if (pnt_id_map[k] == k) { // point not removed, if necessary: id change
 			pnt_id_map[k] = cnt;
 			cnt++;
-		}
-		else
+		} else {
 			pnt_id_map[k] = pnt_id_map[pnt_id_map[k]];
+		}
 	}
-
-	// 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 ()
 {
-	size_t i, j;
+	std::size_t i, j;
 	BruteForceClosestPair (*_data_vec, i, j);
 	_sqr_shortest_dist = MathLib::sqrDist ((*_data_vec)[i], (*_data_vec)[j]);
 }
 
-std::vector<GeoLib::Point*>* PointVec::getSubset(const std::vector<size_t> &subset)
+std::vector<GeoLib::Point*>* PointVec::getSubset(const std::vector<std::size_t> &subset)
 {
 	std::vector<GeoLib::Point*> *new_points (new std::vector<GeoLib::Point*>(subset.size()));
 
-	const size_t nPoints(subset.size());
-	for (size_t i = 0; i < nPoints; i++)
+	const std::size_t nPoints(subset.size());
+	for (std::size_t i = 0; i < nPoints; i++)
 		(*new_points)[i] = new GeoLib::PointWithID((*this->_data_vec)[subset[i]]->getCoords(), subset[i]);
 
 	return new_points;
 }
-
-
 } // end namespace
diff --git a/GeoLib/PointVec.h b/GeoLib/PointVec.h
index e1c82ff50398789034b30dc69ba14a4653da1f85..61a27d3f18bdcc068210e29ec09c9ad78b5c820c 100644
--- a/GeoLib/PointVec.h
+++ b/GeoLib/PointVec.h
@@ -108,7 +108,7 @@ public:
 	std::vector<GeoLib::Point*>* getSubset(const std::vector<std::size_t> &subset);
 
 private:
-	void makePntsUnique (std::vector<GeoLib::Point*>* pnt_vec, std::vector<std::size_t> &pnt_id_map, double eps = sqrt(std::numeric_limits<double>::min()));
+	void makePntsUnique (std::vector<GeoLib::Point*>*& pnt_vec, std::vector<std::size_t> &pnt_id_map, double eps = sqrt(std::numeric_limits<double>::min()));
 
 	/** copy constructor doesn't have an implementation */
 	// compiler does not create a (possible unwanted) copy constructor
diff --git a/Utils/FileConverter/ConvertSHPToGLI.cpp b/Utils/FileConverter/ConvertSHPToGLI.cpp
index 39da935caea6152b1fa2b26babdcc467d794c4a9..1db56dd06ca8a773c9b2df54f0588810aba0fd3b 100644
--- a/Utils/FileConverter/ConvertSHPToGLI.cpp
+++ b/Utils/FileConverter/ConvertSHPToGLI.cpp
@@ -33,9 +33,6 @@
 #include "ProjectData.h"
 #include "Station.h"
 
-#include "problem.h"
-Problem* aproblem = NULL;
-
 void convertPoints (DBFHandle dbf_handle,
                     std::string const& out_fname,
                     size_t x_id,
@@ -48,30 +45,6 @@ void convertPoints (DBFHandle dbf_handle,
 	int n_records (DBFGetRecordCount (dbf_handle));
 	std::cout << "writing " << n_records << " records" << std::endl;
 
-//	out << "#POINTS\n";
-//
-//	for (int k(0); k<n_records; k++) {
-//		double x (DBFReadDoubleAttribute( dbf_handle, k, x_id));
-//		double y (DBFReadDoubleAttribute( dbf_handle, k, y_id));
-//		double z (0.0);
-//		if (z_id != std::numeric_limits<size_t>::max())
-//			z = DBFReadDoubleAttribute( dbf_handle, k, z_id);
-//		out.precision (10);
-//		out.flags (std::ios::fixed);
-//		out << k << " " << x << " " << y << " " << z << std::flush;
-//		if (!name_component_ids.empty()) {
-//			out << " $NAME ";
-//			for (size_t j(0); j<name_component_ids.size(); j++) {
-//				if (name_component_ids[j] != std::numeric_limits<size_t>::max()) {
-//					std::string name (DBFReadStringAttribute( dbf_handle, k, name_component_ids[j]));
-//					out << name.c_str() << " ";
-//				}
-//			}
-//		}
-//		out << "\n";
-//	}
-//	out << "#STOP\n";
-
 	std::vector<GeoLib::Point*>* points (new std::vector<GeoLib::Point*>);
 	points->reserve (n_records);
 
@@ -150,7 +123,7 @@ int main (int argc, char* argv[])
 	{
 		std::cout << "shape file contains " << number_of_elements << " polylines" <<
 		std::endl;
-		std::cout << "this programm only handles point-input files" << std::endl;
+		std::cout << "this programme only handles point-input files" << std::endl;
 		SHPClose(hSHP);
 		return 0;
 	}
@@ -191,6 +164,7 @@ int main (int argc, char* argv[])
 				break;
 			default:
 				std::cout << "      n_decimal " << n_decimals << std::endl;
+				break;
 			}
 		}
 		delete [] field_name;