diff --git a/BaseLib/zlib/CMakeLists.txt b/BaseLib/zlib/CMakeLists.txt
index b278418c0ef6748268ed8d11113ded3a5f08c684..7b52a848f127cc2be53256c65658fce1161a8353 100644
--- a/BaseLib/zlib/CMakeLists.txt
+++ b/BaseLib/zlib/CMakeLists.txt
@@ -105,6 +105,10 @@ string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
 
 add_library(zlib STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
 
+# Workaround for a Visual Studio bug: http://public.kitware.com/Bug/view.php?id=11240
+if(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
+    set_target_properties(zlib PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
+endif()
 
 #============================================================================
 # Example binaries
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6457773a00821243db51964cc761bba0196e3adf..ca7884bd6c99ff24c5f5855b4f26e16110778538 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,9 @@ OPTION(OGS_NO_EXTERNAL_LIBS "Builds OGS without any external dependencies." OFF)
 # Logging
 OPTION(OGS_DISABLE_LOGGING "Disables all logog messages." OFF)
 
+# Search paths
+SET(OGS_LIBS_DIR "" CACHE PATH "The path to the compiled third party libs (mainly used for Windows).")
+
 # Print CMake variable values
 IF (OGS_CMAKE_DEBUG)
 	INCLUDE(ListAllCMakeVariableValues)
diff --git a/FileIO/CMakeLists.txt b/FileIO/CMakeLists.txt
index 60753c25b2fbc708e73663a0bd4382cb5188e2e2..26cbde362f777d1dc8eacf3fc69d0ce2ffed2189 100644
--- a/FileIO/CMakeLists.txt
+++ b/FileIO/CMakeLists.txt
@@ -1,14 +1,26 @@
 # Source files
-GET_SOURCE_FILES(SOURCES_FILEIO)
+# GET_SOURCE_FILES(SOURCES_FILEIO)
+SET( SOURCES
+	Gmsh2GeoIO.cpp
+	GMSInterface.cpp
+	PetrelInterface.cpp
+	readNonBlankLineFromInputStream.cpp
+	Writer.cpp
+)
 GET_SOURCE_FILES(SOURCES_LEGACY Legacy)
 GET_SOURCE_FILES(SOURCES_MESHIO MeshIO)
-SET ( SOURCES ${SOURCES_FILEIO} ${SOURCES_LEGACY} ${SOURCES_MESHIO})
+SET ( SOURCES ${SOURCES} ${SOURCES_LEGACY} ${SOURCES_MESHIO})
 
 IF (QT4_FOUND)
 	GET_SOURCE_FILES(SOURCES_XML XmlIO)
 	SET ( SOURCES ${SOURCES} ${SOURCES_XML})
 ENDIF (QT4_FOUND)
 
+IF (Shapelib_FOUND)
+	SET (SOURCES ${SOURCES} SHPInterface.h SHPInterface.cpp )
+	INCLUDE_DIRECTORIES (${Shapelib_INCLUDE_DIR})
+ENDIF (Shapelib_FOUND)
+
 # Create the library
 ADD_LIBRARY(FileIO STATIC ${SOURCES})
 
diff --git a/FileIO/SHPInterface.cpp b/FileIO/SHPInterface.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c8a9e16f155ac99c4fdb34885d2f2c667f253bf1
--- /dev/null
+++ b/FileIO/SHPInterface.cpp
@@ -0,0 +1,174 @@
+/**
+ * \file SHPInterface.cpp
+ * 25/01/2010 KR Initial implementation
+ */
+
+#include "SHPInterface.h"
+#include "StringTools.h"
+
+// MathLib
+#include "AnalyticalGeometry.h"
+
+bool SHPInterface::readSHPInfo(const std::string &filename, int &shapeType, int &numberOfEntities)
+{
+	SHPHandle hSHP = SHPOpen(filename.c_str(),"rb");
+	if(!hSHP)
+		return false;
+
+	double padfMinBound[4], padfMaxBound[4];
+
+	// The SHPGetInfo() function retrieves various information about shapefile as a whole.
+	// The bounds are read from the file header, and may be inaccurate if the file was improperly generated.
+	SHPGetInfo( hSHP, &numberOfEntities, &shapeType, padfMinBound, padfMaxBound );
+
+	SHPClose(hSHP);
+	return true;
+}
+
+void SHPInterface::readSHPFile(const std::string &filename, OGSType choice, std::string listName)
+{
+	int shapeType, numberOfElements;
+	double padfMinBound[4], padfMaxBound[4];
+
+	SHPHandle hSHP = SHPOpen(filename.c_str(),"rb");
+	SHPGetInfo( hSHP, &numberOfElements, &shapeType, padfMinBound, padfMaxBound );
+
+	if ( ((shapeType - 1) % 10 == 0)  &&  (choice == SHPInterface::POINT) )
+		readPoints(hSHP, numberOfElements, listName);
+	if ( ((shapeType - 1) % 10 == 0)  &&  (choice == SHPInterface::STATION) )
+		readStations(hSHP, numberOfElements, listName);
+	if ( ((shapeType - 3) % 10 == 0 ||
+	      (shapeType - 5) % 10 == 0)  &&  (choice == SHPInterface::POLYLINE) )
+		readPolylines(hSHP, numberOfElements, listName);
+	if ( ((shapeType - 3) % 10 == 0 ||
+	      (shapeType - 5) % 10 == 0)  &&  (choice == SHPInterface::POLYGON) )
+		readPolygons(hSHP, numberOfElements, listName);
+}
+
+void SHPInterface::readPoints(const SHPHandle &hSHP, int numberOfElements, std::string listName)
+{
+	if (numberOfElements > 0)
+	{
+		std::vector<GeoLib::Point*>* points = new std::vector<GeoLib::Point*>();
+		SHPObject* hSHPObject;
+
+		for (int i = 0; i < numberOfElements; i++)
+		{
+			hSHPObject = SHPReadObject(hSHP,i);
+
+			GeoLib::Point* pnt =
+			        new GeoLib::Point( *(hSHPObject->padfX), *(hSHPObject->padfY),
+			                           *(hSHPObject->padfZ) );
+			points->push_back(pnt);
+		}
+
+		_geoObjects->addPointVec(points, listName);
+		SHPDestroyObject(hSHPObject); // de-allocate SHPObject
+	}
+}
+
+void SHPInterface::readStations(const SHPHandle &hSHP, int numberOfElements, std::string listName)
+{
+	if (numberOfElements > 0)
+	{
+		std::vector<GeoLib::Point*>* stations (new std::vector<GeoLib::Point*>);
+		stations->reserve (numberOfElements);
+		SHPObject* hSHPObject;
+
+		for (int i = 0; i < numberOfElements; i++)
+		{
+			hSHPObject = SHPReadObject(hSHP,i);
+			GeoLib::Station* stn =
+			        GeoLib::Station::createStation( number2str(i), *(hSHPObject->padfX),
+			                                        *(hSHPObject->padfY),
+			                                        *(hSHPObject->padfZ) );
+			stations->push_back(stn);
+		}
+
+		_geoObjects->addStationVec(stations, listName);
+		SHPDestroyObject(hSHPObject); // de-allocate SHPObject
+	}
+}
+
+void SHPInterface::readPolylines(const SHPHandle &hSHP, int numberOfElements, std::string listName)
+{
+	size_t noOfPoints = 0, noOfParts = 0;
+	std::vector<GeoLib::Point*>* points = new std::vector<GeoLib::Point*>();
+	std::vector<GeoLib::Polyline*>* lines = new std::vector<GeoLib::Polyline*>();
+	SHPObject* hSHPObject;
+
+	// for each polyline)
+	for (int i = 0; i < numberOfElements; i++)
+	{
+		hSHPObject = SHPReadObject(hSHP,i);
+		noOfPoints = hSHPObject->nVertices;
+		noOfParts  = hSHPObject->nParts;
+
+		for (size_t p = 0; p < noOfParts; p++)
+		{
+			int firstPnt = *(hSHPObject->panPartStart + p);
+			int lastPnt  =
+			        (p < (noOfParts - 1)) ? *(hSHPObject->panPartStart + p + 1) : noOfPoints;
+
+			GeoLib::Polyline* line = new GeoLib::Polyline(*points);
+
+			// for each point in that polyline
+			for (int j = firstPnt; j < lastPnt; j++)
+			{
+				GeoLib::Point* pnt =
+				        new GeoLib::Point( *(hSHPObject->padfX + j),
+				                           *(hSHPObject->padfY + j),
+				                           *(hSHPObject->padfZ + j) );
+				points->push_back(pnt);
+				line->addPoint(points->size() - 1);
+			}
+
+			// add polyline to polyline vector
+			lines->push_back(line);
+		}
+	}
+
+	if (numberOfElements > 0)
+	{
+		// add points vector to GEOObjects (and check for duplicate points)
+		_geoObjects->addPointVec(points, listName);
+
+		// adjust indeces of polylines, remove zero length elements and add vector to GEOObjects
+		this->adjustPolylines(lines, _geoObjects->getPointVecObj(listName)->getIDMap());
+		_geoObjects->addPolylineVec(lines, listName);
+
+		SHPDestroyObject(hSHPObject); // de-allocate SHPObject
+	}
+}
+
+void SHPInterface::readPolygons(const SHPHandle &hSHP, int numberOfElements, std::string listName)
+{
+	this->readPolylines(hSHP, numberOfElements, listName);
+
+	const std::vector<GeoLib::Polyline*>* polylines (_geoObjects->getPolylineVec(listName));
+	std::vector<GeoLib::Surface*>* sfc_vec(new std::vector<GeoLib::Surface*>);
+
+	for (std::vector<GeoLib::Polyline*>::const_iterator poly_it (polylines->begin());
+	     poly_it != polylines->end(); poly_it++)
+	{
+		std::cout << "triangulation of Polygon with " << (*poly_it)->getNumberOfPoints() <<
+		" points ... " << std::flush;
+		sfc_vec->push_back(GeoLib::Surface::createSurface(*(*poly_it)));
+	}
+
+	if (!sfc_vec->empty())
+		_geoObjects->addSurfaceVec(sfc_vec, listName);
+}
+
+void SHPInterface::adjustPolylines (std::vector<GeoLib::Polyline*>* lines,
+                                    std::vector<size_t> id_map)
+
+{
+	for (size_t i = 0; i < lines->size(); i++)
+	{
+		GeoLib::Polyline* line( (*lines)[i] );
+		size_t nPoints( line->getNumberOfPoints() );
+		for (size_t j = 0; j < nPoints; j++)
+			line->setPointID(j, id_map[line->getPointID(j)]);
+	}
+}
diff --git a/FileIO/SHPInterface.h b/FileIO/SHPInterface.h
new file mode 100644
index 0000000000000000000000000000000000000000..171dd252eab36fb363044b9e27d558847d7641d2
--- /dev/null
+++ b/FileIO/SHPInterface.h
@@ -0,0 +1,58 @@
+/**
+ * \file SHPInterface.cpp
+ * 25/01/2010 KR Initial implementation
+ */
+#ifndef SHPINTERFACE_H
+#define SHPINTERFACE_H
+
+#include <string>
+
+//ShapeLib includes
+#include "shapefil.h"
+
+#include "GEOObjects.h"
+
+/**
+ * \brief Manages the import of ESRI shape files into GeoLib.
+ */
+class SHPInterface
+{
+public:
+	/// Connection between ESRI type system for shape files and OGS GeoLib.
+	enum OGSType
+	{
+		UNDEFINED   = 0,
+		POINT       = 1,
+		STATION     = 2,
+		POLYLINE    = 3,
+		POLYGON     = 4
+	};
+
+	/// Constructor
+	SHPInterface(GeoLib::GEOObjects* geoObjects) : _geoObjects(geoObjects) {}
+
+	/// Reads the header of the shape file.
+	bool readSHPInfo(const std::string &filename, int &shapeType, int &numberOfEntities);
+
+	/// Reads data from the shape file.
+	void readSHPFile(const std::string &filename, OGSType choice, std::string listName);
+
+private:
+	/// Reads points into a vector of Point objects.
+	void readPoints    (const SHPHandle &hSHP, int numberOfElements, std::string listName);
+
+	/// Reads points into a vector of Point objects and marks them as Station.
+	void readStations  (const SHPHandle &hSHP, int numberOfElements, std::string listName);
+
+	/// Reads lines into a vector of Polyline objects.
+	void readPolylines (const SHPHandle &hSHP, int numberOfElements, std::string listName);
+
+	/// Reads lines into a vector of Polyline and Surface objects.
+	void readPolygons  (const SHPHandle &hSHP, int numberOfElements, std::string listName);
+
+	void adjustPolylines (std::vector<GeoLib::Polyline*>* lines, std::vector<size_t>  id_map);
+
+	GeoLib::GEOObjects* _geoObjects;
+};
+
+#endif //SHPINTERFACE_H
diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake
index e6b98de5295cf2aa021ff3e9d2fd8766308c0a26..4f3564ed45998967c062a2c821902757ec837f9a 100644
--- a/scripts/cmake/Find.cmake
+++ b/scripts/cmake/Find.cmake
@@ -1,3 +1,12 @@
+############################
+### Find OGS directories ###
+############################
+
+# Compiled libraries (for Windows)
+FIND_PATH(OGS_LIBS_DIR_FOUND geotiff.lib
+	PATHS $ENV{OGS_LIBS} ${OGS_LIBS_DIR} ${PROJECT_SOURCE_DIR}/../Libs C:/OGS_Libs
+	PATH_SUFFIXES libgeotiff)
+
 ######################
 ### Find tools     ###
 ######################
@@ -100,3 +109,9 @@ FIND_PACKAGE( LibGeoTiff )
 IF(libgeotiff_FOUND)
 	ADD_DEFINITIONS(-Dlibgeotiff_FOUND)
 ENDIF() # libgeotiff_FOUND
+
+## shapelib ##
+FIND_PACKAGE( Shapelib )
+IF(Shapelib_FOUND)
+	ADD_DEFINITIONS(-DShapelib_FOUND)
+ENDIF() # Shapelib_FOUND
diff --git a/scripts/cmake/FindLibGeoTiff.cmake b/scripts/cmake/FindLibGeoTiff.cmake
index 8b46fc9cff51320cf61e0bd1f2124a1d1c151c8b..1c2934a16c5f86f2b78ac013d30b2076ab651b04 100644
--- a/scripts/cmake/FindLibGeoTiff.cmake
+++ b/scripts/cmake/FindLibGeoTiff.cmake
@@ -11,20 +11,24 @@ if (NOT libgeotiff_FOUND)
 
 	find_path( libgeotiff_INCLUDE_DIR
 			NAMES geotiff.h
-			PATHS	/usr/include
+			PATHS
+				/usr/include
 				/usr/include/libgeotiff
 				/usr/include/geotiff
 				${CMAKE_SOURCE_DIR}/../Libs/libgeotiff
-				C:/OGS_Libs/libgeotiff
-				$ENV{OGS_LIBS}/libgeotiff)
+				$ENV{OGS_LIBS}/libgeotiff
+				${OGS_LIBS_DIR_FOUND}/libgeotiff
+			)
 
 	find_library(libgeotiff_LIBRARIES
 		NAMES geotiff
-		PATHS	/usr/lib64
+		PATHS
+			/usr/lib64
 			/usr/lib
 			${CMAKE_SOURCE_DIR}/../Libs/libgeotiff
-			C:/OGS_Libs/libgeotiff
-			$ENV{OGS_LIBS}/libgeotiff)
+			$ENV{OGS_LIBS}/libgeotiff
+			${OGS_LIBS_DIR_FOUND}/libgeotiff
+		)
 
 
 	# Set the include dir variables and the libraries and let libfind_process do the rest.
diff --git a/scripts/cmake/FindLibTiff.cmake b/scripts/cmake/FindLibTiff.cmake
index 96b4cac12d28d9fd413d008aa00ac55c168ede21..25014a26913e3f3cf2561b03cc5a51ee64da8d5f 100644
--- a/scripts/cmake/FindLibTiff.cmake
+++ b/scripts/cmake/FindLibTiff.cmake
@@ -11,21 +11,30 @@ if (NOT libtiff_FOUND)
 
 	find_path( libtiff_INCLUDE_DIR
 		NAMES tiff.h
-		PATHS	/usr/include
+		PATHS
+			/usr/include
 			${CMAKE_SOURCE_DIR}/../Libs/libtiff/libtiff
-			C:/OGS_Libs/libtiff
-			$ENV{OGS_LIBS}/libtiff)
+			$ENV{OGS_LIBS}/libtiff
+			${OGS_LIBS_DIR_FOUND}/libtiff/libtiff
+		)
 
 	if ( UNIX )
 		find_library(libtiff_LIBRARIES
 			NAMES tiff
-			PATHS /usr/lib64 /usr/lib ${CMAKE_SOURCE_DIR}/../Libs/libtiff/libtiff)
+			PATHS
+				/usr/lib64
+				/usr/lib
+				${CMAKE_SOURCE_DIR}/../Libs/libtiff/libtiff
+				${OGS_LIBS_DIR_FOUND}/libtiff/libtiff
+			)
 	else ( UNIX )
 		find_library(libtiff_LIBRARIES
 			NAMES libtiff
-			PATHS	${CMAKE_SOURCE_DIR}/../Libs/libtiff/libtiff
-				C:/OGS_Libs/libtiff
-				$ENV{OGS_LIBS}/libtiff)
+			PATHS
+				${CMAKE_SOURCE_DIR}/../Libs/libtiff/libtiff
+				$ENV{OGS_LIBS}/libtiff
+				${OGS_LIBS_DIR_FOUND}/libtiff
+			)
 	endif ( UNIX )
 
 
diff --git a/scripts/cmake/FindMetis.cmake b/scripts/cmake/FindMetis.cmake
index c9518513c277831a5aadc73252263cb6ece91377..c13486ef2f7b37b1be2d5718063ddfbf07614766 100644
--- a/scripts/cmake/FindMetis.cmake
+++ b/scripts/cmake/FindMetis.cmake
@@ -15,12 +15,14 @@ FIND_PATH(METIS_INCLUDE_DIR metis.h
 	/usr/include/metis
 	$ENV{HOME}/include/
 	${CMAKE_SOURCE_DIR}/../libs/include
+	${OGS_LIBS_DIR_FOUND}/include
 )
 
 FIND_LIBRARY(METIS_LIBRARY metis
 	/usr/lib
 	$ENV{HOME}/lib/
 	${CMAKE_SOURCE_DIR}/../libs/lib
+	${OGS_LIBS_DIR_FOUND}/lib
 )
 
 SET(METIS_LIBRARIES ${METIS_LIBRARY})
diff --git a/scripts/cmake/FindShapelib.cmake b/scripts/cmake/FindShapelib.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..3db1320ad127a394ff76530dc31d7634468d128c
--- /dev/null
+++ b/scripts/cmake/FindShapelib.cmake
@@ -0,0 +1,45 @@
+# - Try to find Shapelib
+# Once done, this will define
+#
+#  Shapelib_FOUND
+#  Shapelib_INCLUDE_DIRS
+#  Shapelib_LIBRARIES
+
+if (NOT Shapelib_FOUND)
+
+	include(LibFindMacros)
+
+	set(SEARCH_DIRS
+		${CMAKE_SOURCE_DIR}/../Libs/shapelib
+		C:/OGS_Libs/shapelib
+		$ENV{OGS_LIBS}/shapelib
+		${OGS_LIBS_DIR_FOUND}/shapelib
+	)
+
+	find_path( Shapelib_INCLUDE_DIR
+		NAMES shapefil.h
+		PATHS
+			/usr/include/libshp
+			${SEARCH_DIRS}
+		)
+
+	find_library(Shapelib_LIBRARIES
+		NAMES shp
+		PATHS ${SEARCH_DIRS}
+	)
+	find_library(Shapelib_LIBRARIES
+		NAMES shapelib
+		PATHS ${SEARCH_DIRS}
+	)
+
+	# Set the include dir variables and the libraries and let libfind_process do the rest.
+	# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
+	if (NOT Shapelib_LIBRARIES STREQUAL "Shapelib_LIBRARIES-NOTFOUND" AND NOT Shapelib_INCLUDE_DIR STREQUAL "Shapelib_INCLUDE_DIR-NOTFOUND")
+		set(Shapelib_PROCESS_INCLUDES Shapelib_INCLUDE_DIR)
+		set(Shapelib_PROCESS_LIBS Shapelib_LIBRARIES)
+		libfind_process(Shapelib)
+	else (NOT Shapelib_LIBRARIES STREQUAL "Shapelib_LIBRARIES-NOTFOUND" AND NOT Shapelib_INCLUDE_DIR STREQUAL "Shapelib_INCLUDE_DIR-NOTFOUND")
+		#message (STATUS "Warning: shapelib not found!")
+	endif (NOT Shapelib_LIBRARIES STREQUAL "Shapelib_LIBRARIES-NOTFOUND" AND NOT Shapelib_INCLUDE_DIR STREQUAL "Shapelib_INCLUDE_DIR-NOTFOUND")
+
+endif (NOT Shapelib_FOUND)