diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4ce4d675a556308f5b1031c3f4446050d9a15eb..e0c84a700e5431865a5b88b1e87399573e5e63b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -183,6 +183,9 @@ if (ENABLE_STATIC AND UNIX AND NOT APPLE)
 endif()
 
 setup_boost()
+if (WIN32)
+   ADD_DEFINITIONS("-DBOOST_ALL_NO_LIB")
+endif()
 
 if (ENABLE_INFO)        
   find_package(Qt4 4.5.0 REQUIRED)
diff --git a/cmake_support/CopyDependencies.cmake b/cmake_support/CopyDependencies.cmake
index ae48aaa8867e499c9cda736aaae59132496c0a87..60f399430c3936f7e503af33c278a3a61c045bc3 100644
--- a/cmake_support/CopyDependencies.cmake
+++ b/cmake_support/CopyDependencies.cmake
@@ -240,7 +240,9 @@ function(resolve_item context item exepath resolved_item_var)
     string(REPLACE "@loader_path" "${contextpath}" resolved_item "${resolved_item}")
   endif(resolved_item MATCHES "@loader_path")
   
-  get_filename_component(resolved_item "${resolved_item}" REALPATH)
+  if(NOT WIN32)
+    get_filename_component(resolved_item "${resolved_item}" REALPATH)
+  endif(NOT WIN32)
 
   if(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}")
     set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE)
@@ -248,12 +250,14 @@ function(resolve_item context item exepath resolved_item_var)
   endif(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}")
 
   set(ri "ri-NOTFOUND")
-  find_file(ri "${item}" ${exepath}  NO_DEFAULT_PATH)
-  find_file(ri "${item}" ${exepath}  /usr/lib)
-  if(WIN32 AND NOT UNIX)
+  if(UNIX AND NOT WIN32)
+    find_file(ri "${item}" ${exepath}  NO_DEFAULT_PATH)
+    find_file(ri "${item}" ${exepath}  /usr/lib)
+  else(UNIX AND NOT WIN32)
     find_program(ri "${item}" PATHS "${exepath}" NO_DEFAULT_PATH)
+    find_program(ri "${item}" PATHS "${CMAKE_INSTALL_PREFIX}/bin" NO_DEFAULT_PATH)
     find_program(ri "${item}" PATHS "${exepath}")
-  endif(WIN32 AND NOT UNIX)
+  endif(UNIX AND NOT WIN32)
   if(ri)
     set(resolved_item "${ri}")
     set(ri "ri-NOTFOUND")
@@ -277,7 +281,11 @@ function(resolve_embedded_item item resolved_item_var)
   else(${item} MATCHES ${CMAKE_INSTALL_PREFIX})
     # only embed libraries, therefore put into lib dir
     get_filename_component(item_name "${item}" NAME)
-    set(${resolved_item_var} "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/${item_name}" PARENT_SCOPE)
+    if(WIN32 AND NOT UNIX)
+      set(${resolved_item_var} "${CMAKE_INSTALL_PREFIX}/bin/${item_name}" PARENT_SCOPE)
+    else(WIN32 AND NOT UNIX)
+      set(${resolved_item_var} "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/${item_name}" PARENT_SCOPE)
+    endif(WIN32 AND NOT UNIX)
   endif(${item} MATCHES ${CMAKE_INSTALL_PREFIX})
 endfunction(resolve_embedded_item)
 
@@ -333,17 +341,19 @@ endfunction(change_install_names_for_item)
 #=============================================================================
 function(verify keys_var)
   foreach(key ${${keys_var}})
-    get_dependencies_for_item("${${key}_RESOLVED_EMBEDDED_ITEM}" dependencies)
-    get_filename_component(exepath ${${key}_RESOLVED_EMBEDDED_ITEM} PATH)
-    foreach(dep ${dependencies})
-      resolve_item( ${${key}_RESOLVED_EMBEDDED_ITEM} ${dep} exepath resolved_dep)
-      is_system_lib(${resolved_dep} system_flag)
-      if(NOT ${system_flag})
-        if(NOT ${resolved_dep} MATCHES ${CMAKE_INSTALL_PREFIX})
-          MESSAGE("Warning: item:'${${key}_RESOLVED_EMBEDDED_ITEM}' contains external dependency:'${resolved_dep}'")
-        endif(NOT ${resolved_dep} MATCHES ${CMAKE_INSTALL_PREFIX})
-      endif(NOT ${system_flag})
-    endforeach(dep)
+    if(NOT ${${key}_SYSTEMFLAG})
+      get_dependencies_for_item("${${key}_RESOLVED_EMBEDDED_ITEM}" dependencies)
+      get_filename_component(exepath ${${key}_RESOLVED_EMBEDDED_ITEM} PATH)
+      foreach(dep ${dependencies})
+        resolve_item( ${${key}_RESOLVED_EMBEDDED_ITEM} ${dep} exepath resolved_dep)
+        is_system_lib(${resolved_dep} system_flag)
+        if(NOT ${system_flag})
+          if(NOT ${resolved_dep} MATCHES ${CMAKE_INSTALL_PREFIX})
+            MESSAGE("Warning: item:'${${key}_RESOLVED_EMBEDDED_ITEM}' contains external dependency:'${resolved_dep}'")
+          endif(NOT ${resolved_dep} MATCHES ${CMAKE_INSTALL_PREFIX})
+        endif(NOT ${system_flag})
+      endforeach(dep)
+    endif(NOT ${${key}_SYSTEMFLAG})
   endforeach(key)
 endfunction(verify)
 
@@ -649,6 +659,28 @@ function(copy_resolved_item resolved_item resolved_embedded_item)
 
 endfunction(copy_resolved_item)
 
+#=============================================================================
+# function copy_python (OSX)
+#=============================================================================
+function(copy_python include_path version new_binary_path)
+
+
+  get_filename_component(real_python_include_path ${include_path} REALPATH)
+  get_filename_component(python_root_dir ${real_python_include_path}/../.. REALPATH) 
+  file(COPY ${python_root_dir}/${LIB_DIR}/python${version}/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/python${version})
+  file(GLOB  py_config_files "${include_path}/pyconfig*.h")
+  file(COPY ${py_config_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/python${version})
+  file(GLOB_RECURSE python_so_files "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/python${version}/*.so")
+  foreach(so_file ${python_so_files})
+    file(RPATH_REMOVE FILE "${so_file}")
+  endforeach(so_file)
+  read_config(ost_config)
+  file(COPY ${python_root_dir}/Resources/Python.app/Contents/MacOS/Python DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+  set(${new_binary_path} "${CMAKE_INSTALL_PREFIX}/bin/Python" PARENT_SCOPE)
+  string(REGEX REPLACE "pyexec=\"[^\n\$]*\"" "pyexec=\"\$DNG_BINDIR/Python\"\nexport PYTHONHOME=\$DNG_ROOT" ost_config "${ost_config}")
+  write_config("${ost_config}")
+endfunction(copy_python)
+
 
 elseif(WIN32 AND NOT UNIX)
 
@@ -675,8 +707,19 @@ function(get_dependencies_for_item  item list_var)
   endif(NOT dumpbin_cmd)
 
   set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
-  execute_process( COMMAND ${dumpbin_cmd}  /dependents ${item} OUTPUT_VARIABLE dumpbin_cmd_ov RESULT_VARIABLE retcode)
+  execute_process( COMMAND ${dumpbin_cmd}  /dependents ${item} OUTPUT_VARIABLE dumpbin_cmd_ov  ERROR_VARIABLE dumpbin_cmd_ev RESULT_VARIABLE retcode)
+  if(retcode)
+    if(${item} MATCHES "System32")
+      # 32 bit cmake might run within WOW64, which automatically mangles the path to System32
+      # dumpbin, which is x86_64 in this case will run with the unmangled path and therefore has to look for
+      # the 32 bit libraries in SysWOW64 instead of System32
+      string(REPLACE "System32" "SysWOW64" item ${item})
+      execute_process( COMMAND ${dumpbin_cmd}  /dependents ${item} OUTPUT_VARIABLE dumpbin_cmd_ov  ERROR_VARIABLE dumpbin_cmd_ev RESULT_VARIABLE retcode)
+    endif(${item} MATCHES "System32")
+  endif(retcode)
   if(retcode)
+    MESSAGE( "dumpbin output: '${dumpbin_cmd_ov}'")
+    MESSAGE( "dumpbin error output: '${dumpbin_cmd_ev}'")
     MESSAGE(FATAL_ERROR "dumpbin stopped with return code: '${retcode}'")
   endif(retcode)
   # Convert to a list of lines:
@@ -693,6 +736,7 @@ function(get_dependencies_for_item  item list_var)
       string(REGEX REPLACE "${dumpbin_regex}" "\\1" dep "${candidate}")
       list(APPEND dep_list ${dep})
     endif("${candidate}" MATCHES "${dumpbin_regex}")
+  endforeach(candidate)
   set(${list_var} ${dep_list} PARENT_SCOPE)
 endfunction(get_dependencies_for_item)
 
@@ -712,7 +756,7 @@ function(is_system_lib item system_var)
   string(REGEX REPLACE "\\\\" "/" sysroot "${sysroot}")
   string(TOLOWER "$ENV{windir}" windir)
   string(REGEX REPLACE "\\\\" "/" windir "${windir}")
-  if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
+  if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)" AND NOT lower MATCHES "python.*dll")
     set(${system_var}  1 PARENT_SCOPE)
   else()
     set(${system_var}  0 PARENT_SCOPE)
@@ -736,6 +780,52 @@ function(copy_resolved_item resolved_item resolved_embedded_item)
 
 endfunction(copy_resolved_item)
 
+#=============================================================================
+# function copy_python (Windows)
+#=============================================================================
+function(copy_python include_path version new_binary_path)
+  get_filename_component(real_python_include_path ${include_path} REALPATH)
+  get_filename_component(python_root_dir ${real_python_include_path}/.. REALPATH) 
+  file(GLOB  lib_files "${python_root_dir}/Lib/*")
+  file(COPY ${lib_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/python${version})
+  file(GLOB  dll_files "${python_root_dir}/DLLs/*")
+  file(COPY ${dll_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/python${version})
+  file(GLOB  py_config_files "${include_path}/pyconfig*.h")
+  file(COPY ${py_config_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/python${version})
+  file(COPY ${python_root_dir}/python.exe DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+  set(${new_binary_path} "${CMAKE_INSTALL_PREFIX}/bin/python.exe" PARENT_SCOPE)
+  
+  # copy msvc90 CRT for python
+  get_filename_component(msvc90_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE)
+  get_filename_component(msvc90_express_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]" ABSOLUTE)
+  find_path(msvc_redist_dir NAMES x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
+            PATHS
+            "${msvc90_dir}/../../VC/redist"
+            "${msvc90_express_dir}/../../VC/redist"
+            "C:/Program Files/Microsoft Visual Studio 9.0/VC/redist"
+            "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/redist"
+    )
+  set(msvc90_crt_dir "${msvc_redist_dir}/x86/Microsoft.VC90.CRT")
+  file(COPY "${msvc90_crt_dir}/Microsoft.VC90.CRT.manifest"
+            "${msvc90_crt_dir}/msvcm90.dll"
+            "${msvc90_crt_dir}/msvcp90.dll"
+            "${msvc90_crt_dir}/msvcr90.dll"
+       DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
+
+endfunction(copy_python)
+
+#=============================================================================
+# function copy_qt (Windows)
+#=============================================================================
+function(copy_qt library_dir plugin_dir plugins)
+  file(COPY ${plugin_dir}
+       DESTINATION ${CMAKE_INSTALL_PREFIX}/libexec/openstructure) 
+  file(GLOB_RECURSE QT_PLUGINS "${CMAKE_INSTALL_PREFIX}/libexec/openstructure/*.dll")
+  set(${plugins} ${QT_PLUGINS} PARENT_SCOPE)
+  file(WRITE "${CMAKE_INSTALL_PREFIX}/libexec/openstructure/qt.conf" "[Paths]\nPlugins=../plugins\n")
+endfunction(copy_qt)
+
+
 elseif(UNIX)
 
 
@@ -877,8 +967,29 @@ function(copy_resolved_item resolved_item resolved_embedded_item)
 
 endfunction(copy_resolved_item)
 
+#=============================================================================
+# function copy_python (Linux)
+#=============================================================================
+function(copy_python include_path version new_binary_path)
 
 
+  get_filename_component(real_python_include_path ${include_path} REALPATH)
+  get_filename_component(python_root_dir ${real_python_include_path}/../.. REALPATH) 
+  file(COPY ${python_root_dir}/${LIB_DIR}/python${version}/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/python${version})
+  file(GLOB  py_config_files "${include_path}/pyconfig*.h")
+  file(COPY ${py_config_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/python${version})
+  file(GLOB_RECURSE python_so_files "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/python${version}/*.so")
+  foreach(so_file ${python_so_files})
+    file(RPATH_REMOVE FILE "${so_file}")
+  endforeach(so_file)
+  read_config(ost_config)
+  file(GLOB python_libs "${python_root_dir}/${LIB_DIR}/libpython${version}.so*")
+  file(COPY ${python_libs} DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_DIR})
+  file(COPY ${python_root_dir}/bin/python${version} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+  set(${new_binary_path} "${CMAKE_INSTALL_PREFIX}/bin/python${version}" PARENT_SCOPE)
+  string(REGEX REPLACE "pyexec=\"[^\n\$]*\"" "pyexec=\"\$DNG_BINDIR/python${version}\"\nexport PYTHONHOME=\$DNG_ROOT" ost_config "${ost_config}")
+  write_config("${ost_config}")
+endfunction(copy_python)
 
 
 #=============================================================================
diff --git a/cmake_support/FindPython.cmake b/cmake_support/FindPython.cmake
index c3b6f7dfdf3da9f18f05561be504928a52dfe2f3..702744428efb4d11abff9b354f8c84a4d7a0950e 100644
--- a/cmake_support/FindPython.cmake
+++ b/cmake_support/FindPython.cmake
@@ -47,7 +47,7 @@ macro(_find_python PYTHON_ROOT VERSION)
     find_library(PYTHON_LIBRARIES
       NAMES "python${_VERSION_NO_DOTS}" "python${VERSION}"
       HINTS "${PYTHON_ROOT}"
-      PATH_SUFFIXES lib
+      PATH_SUFFIXES lib libs
       NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
     )
     find_path(PYTHON_INCLUDE_PATH
@@ -72,7 +72,7 @@ macro(_find_python_bin PYTHON_ROOT VERSION)
   string(REPLACE "." "" _VERSION_NO_DOTS "${VERSION}")
   if(PYTHON_ROOT)
     find_program(PYTHON_BINARY
-      NAMES "python${_VERSION_NO_DOTS}" "python${VERSION}"
+      NAMES "python${_VERSION_NO_DOTS}" "python${VERSION}" python.exe
       HINTS "${PYTHON_ROOT}"
       PATH_SUFFIXES bin
       NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake
index 1145f5cdb9adfac9bc2a60e12bb738e352b1ed16..07e4817b359642c23f93b41b1cf58592fa7e71f6 100644
--- a/cmake_support/OST.cmake
+++ b/cmake_support/OST.cmake
@@ -192,25 +192,20 @@ macro(module)
   # create library  
   #-----------------------------------------------------------------------------
   file(MAKE_DIRECTORY ${LIB_STAGE_PATH})
-  file(MAKE_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
+  file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
   file(MAKE_DIRECTORY ${LIBEXEC_STAGE_PATH})
   file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
   if (NOT TARGET create_stage)
     add_custom_target(create_stage COMMAND ${CMAKE_COMMAND} -E make_directory ${LIB_STAGE_PATH}
-                                   COMMAND ${CMAKE_COMMAND} -E make_directory ${EXECUTABLE_OUTPUT_PATH}
+                                   COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
                                    COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBEXEC_STAGE_PATH}
                                    COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/tests")
   endif()
-  if (WIN32)
-    set(_ABS_FILE_PATTERN "^[A-Z]:/")
-  else()
-    set(_ABS_FILE_PATTERN "^/")
-  endif()
   if (_ARG_SOURCES)
     # when there is at least one source file, we build a library
     set(_ABS_SOURCE_NAMES)
     foreach(_SOURCE ${_ARG_SOURCES})
-      if (_SOURCE MATCHES ${_ABS_FILE_PATTERN})
+      if (IS_ABSOLUTE ${_SOURCE})
         list(APPEND _ABS_SOURCE_NAMES "${_SOURCE}")
       else()
         list(APPEND _ABS_SOURCE_NAMES "${CMAKE_CURRENT_SOURCE_DIR}/${_SOURCE}")
@@ -243,8 +238,7 @@ macro(module)
                             INSTALL_NAME_DIR "@rpath")
     endif()
     if (WIN32)
-      #set_target_properties(${_LIB_NAME} PROPERTIES PREFIX "../")
-      install(TARGETS ${_LIB_NAME} ARCHIVE DESTINATION "${LIB_DIR}")
+      install(TARGETS ${_LIB_NAME} RUNTIME DESTINATION bin)
     else()
       if (ENABLE_STATIC)
         install(TARGETS ${_LIB_NAME} ARCHIVE DESTINATION "${LIB_DIR}")
@@ -293,7 +287,9 @@ macro(stage_and_install_headers HEADERLIST HEADER_OUTPUT_DIR TARGET)
     set(_HDR_STAGE_DIR "${HEADER_OUTPUT_DIR}/${_DIR}")
     set(_FULL_HEADER_DIR "${HEADER_STAGE_PATH}/${_HDR_STAGE_DIR}")
     copy_if_different("" "${_FULL_HEADER_DIR}" "${_ABS_HEADER_NAMES}" "" "${TARGET}_headers")
-    install(FILES ${_ABS_HEADER_NAMES} DESTINATION "include/${_HDR_STAGE_DIR}")
+    if(NOT WIN32)
+      install(FILES ${_ABS_HEADER_NAMES} DESTINATION "include/${_HDR_STAGE_DIR}")
+    endif(NOT WIN32)
   endforeach()
 endmacro()
 
@@ -357,6 +353,12 @@ macro(executable_libexec)
   set_target_properties(${_ARG_NAME}
                         PROPERTIES RUNTIME_OUTPUT_DIRECTORY
                        "${LIBEXEC_STAGE_PATH}")  
+  set_target_properties(${_ARG_NAME}
+                        PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
+                       "${LIBEXEC_STAGE_PATH}")  
+  set_target_properties(${_ARG_NAME}
+                        PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
+                       "${LIBEXEC_STAGE_PATH}")  
   if (NOT _ARG_NO_RPATH AND NOT _ARG_STATIC)
     if (APPLE)
       set_target_properties(${_ARG_NAME} PROPERTIES
@@ -447,7 +449,7 @@ macro(ui_to_python LIBNAME PYMODDIR STAGEDIR)
   add_custom_target("${LIBNAME}_ui" ALL)
   add_dependencies("_${LIBNAME}" "${LIBNAME}_ui")
   find_program(_PYUIC_EXECUTABLE
-    NAMES pyuic4-${PYTHON_VERSION} pyuic4 pyuic
+    NAMES pyuic4-${PYTHON_VERSION} pyuic4 pyuic pyuic4.bat
     PATHS  ENV PATH 
   )  
   if(NOT _PYUIC_EXECUTABLE)
@@ -465,23 +467,26 @@ macro(ui_to_python LIBNAME PYMODDIR STAGEDIR)
                        )
     list(APPEND out_files ${_abs_out_file})
   endforeach()
-  compile_py_files(_${LIBNAME} ${STAGEDIR} ${out_files})
+  compile_py_files(_${LIBNAME} ${STAGEDIR} compiled_files ${out_files})
   install(FILES ${out_files} DESTINATION "${LIB_DIR}/${PYMODDIR}")
+  install(FILES ${compiled_files} DESTINATION "${LIB_DIR}/${PYMODDIR}")
 endmacro()
 
 #-------------------------------------------------------------------------------
 # Synopsis:
-#   compile_py_files(module out_files [input_file1 ...])
+#   compile_py_files(module out_dir compiled_files [input_file1 ...])
 # Description:
 #   Calls pyuic on every input file. The resulting python files are stored in
-#   the variable with name out_files.
+#   the variable with name compiled_files.
 #-------------------------------------------------------------------------------
-macro(compile_py_files module out_dir)
+macro(compile_py_files module out_dir compiled_files_name)
   set(_input_files ${ARGN})
+  set(${compiled_files_name})
   foreach(input_file ${_input_files})
     get_filename_component(_out_file ${input_file} NAME_WE)
     get_filename_component(_in_file ${input_file} ABSOLUTE)
     set(_out_file ${out_dir}/${_out_file}.pyc)
+    list(APPEND ${compiled_files_name} ${_out_file})
     get_filename_component(_in_name ${input_file} NAME)
     file(MAKE_DIRECTORY  ${out_dir})
     add_custom_command(TARGET ${module}
@@ -545,7 +550,11 @@ macro(pymod)
 
     set_target_properties("_${_LIB_NAME}"
                           PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYMOD_STAGE_DIR})
- 
+    set_target_properties("_${_LIB_NAME}"
+                          PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PYMOD_STAGE_DIR})
+    set_target_properties("_${_LIB_NAME}"
+                          PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PYMOD_STAGE_DIR})
+
     if (NOT ENABLE_STATIC)
       if (_USE_RPATH)
         string(REGEX REPLACE "/[^/]*" "/.." inv_pymod_path "/${PYMOD_DIR}")
@@ -566,12 +575,8 @@ macro(pymod)
       set_target_properties("_${_LIB_NAME}"
                           PROPERTIES PREFIX "")
     else ()
-      set_target_properties("_${_LIB_NAME}"
-                          PROPERTIES PREFIX "../")
-
       set_target_properties("_${_LIB_NAME}"
                           PROPERTIES SUFFIX ".pyd")
-
     endif()
     install(TARGETS "_${_LIB_NAME}" LIBRARY DESTINATION
             "${LIB_DIR}/${PYMOD_DIR}")
@@ -605,7 +610,8 @@ macro(pymod)
       copy_if_different("./" "${PYMOD_STAGE_DIR}/${_DIR}"
                         "${_ABS_PY_FILES}" "TARGETS"
                         "${_PYMOD_TARGET}")
-      compile_py_files(_${_LIB_NAME} ${PYMOD_STAGE_DIR}/${_DIR} ${_ABS_PY_FILES})
+      compile_py_files(_${_LIB_NAME} ${PYMOD_STAGE_DIR}/${_DIR} compiled_files ${_ABS_PY_FILES})
+      install(FILES ${compiled_files} DESTINATION "${LIB_DIR}/${PYMOD_DIR}/${_DIR}")
     endforeach()
   endif()  
   get_target_property(_MOD_DEPS "${_PARENT_NAME}" MODULE_DEPS)
@@ -651,14 +657,20 @@ macro(ost_unittest)
       else()
         add_executable(${_test_name} EXCLUDE_FROM_ALL ${_SOURCES})
       endif()
+      set_target_properties(${_test_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests"  )
+      set_target_properties(${_test_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/tests"  )
+      set_target_properties(${_test_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/tests"  )
+
       if (WIN32)
         target_link_libraries(${_test_name} ${BOOST_UNIT_TEST_LIBRARIES} "${_ARG_PREFIX}_${_ARG_MODULE}")  
-        add_custom_target("${_test_name}_run":
-                        COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${_test_name}.exe || echo
-                        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/..
-                        COMMENT "running checks for module ${_ARG_MODULE}"
-                        DEPENDS ${_test_name})
-        add_test("${_test_name}" ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${_test_name}.exe)
+        #add_custom_target("${_test_name}_run":
+        #                COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${_test_name}.exe || echo
+        #                WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/..
+        #                COMMENT "running checks for module ${_ARG_MODULE}"
+        #                DEPENDS ${_test_name})
+        #add_test("${_test_name}" ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${_test_name}.exe)
+        #set_target_properties("${_test_name}_run" PROPERTIES EXCLUDE_FROM_ALL "1")
+        #add_dependencies(check "${_test_name}_run")
       else()
         target_link_libraries(${_test_name} ${BOOST_UNIT_TEST_LIBRARIES}
                             "${_ARG_PREFIX}_${_ARG_MODULE}")
@@ -673,29 +685,30 @@ macro(ost_unittest)
                         COMMENT "running checks for module ${_ARG_MODULE}"
                         DEPENDS ${_test_name})
         add_test("${_test_name}" ${CMAKE_CURRENT_BINARY_DIR}/${_test_name} )
+        add_dependencies(check_xml "${_test_name}_run_xml")
+        add_dependencies(check "${_test_name}_run")
       endif()
       
       if (_ARG_LINK)
         target_link_libraries("${_test_name}" ${_ARG_LINK})
       endif()
 
-      add_dependencies(check "${_test_name}_run")
-      add_dependencies(check_xml "${_test_name}_run_xml")
       set_target_properties(${_test_name}
                             PROPERTIES RUNTIME_OUTPUT_DIRECTORY
                             "${CMAKE_CURRENT_BINARY_DIR}")
-      if (WIN32)
-        set_target_properties("${_test_name}_run" PROPERTIES EXCLUDE_FROM_ALL "1")
-      endif()
     endif()
 
     foreach(py_test ${PY_TESTS})
       if(WIN32)
-        set (PY_TESTS_CMD "${PYTHON_BINARY}")
-        add_custom_target("${py_test}_run"
-                  CALL "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo"
-                  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-                  COMMENT "running checks ${py_test}" VERBATIM)
+        # todo fix python unit test running for Windows
+        #set (PY_TESTS_CMD "${EXECUTABLE_OUTPUT_PATH}/ost.bat")
+        #add_custom_target("${py_test}_run"
+        #          CALL "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo"
+        #          WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        #          COMMENT "running checks ${py_test}" VERBATIM)
+        #set_target_properties("${py_test}_run" PROPERTIES EXCLUDE_FROM_ALL "1")
+        #add_dependencies("${py_test}_run" ost_scripts "_${_ARG_PREFIX}_${_ARG_MODULE}")
+        #add_dependencies(check "${py_test}_run")
       else()
         set(python_path $ENV{PYTHONPATH})
         if(python_path)
@@ -711,13 +724,10 @@ macro(ost_unittest)
                   sh -c "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} xml || echo"
                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                   COMMENT "running checks ${py_test}" VERBATIM)
-      endif()
-      add_dependencies("${py_test}_run" ost_scripts "_${_ARG_PREFIX}_${_ARG_MODULE}")
-      add_dependencies("${py_test}_run_xml" ost_scripts "_${_ARG_PREFIX}_${_ARG_MODULE}")
-      add_dependencies(check "${py_test}_run")
-      add_dependencies(check_xml "${py_test}_run_xml")
-      if (WIN32)
-        set_target_properties("${py_test}_run" PROPERTIES EXCLUDE_FROM_ALL "1")
+        add_dependencies("${py_test}_run_xml" ost_scripts "_${_ARG_PREFIX}_${_ARG_MODULE}")
+        add_dependencies("${py_test}_run" ost_scripts "_${_ARG_PREFIX}_${_ARG_MODULE}")
+        add_dependencies(check "${py_test}_run")
+        add_dependencies(check_xml "${py_test}_run_xml")
       endif()
       
     endforeach()
@@ -808,7 +818,9 @@ endmacro()
 #-------------------------------------------------------------------------------
 macro(setup_stage)
   set(STAGE_DIR "${CMAKE_BINARY_DIR}/stage")
-  set(EXECUTABLE_OUTPUT_PATH ${STAGE_DIR}/bin  )
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${STAGE_DIR}/bin  )
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${STAGE_DIR}/bin  )
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${STAGE_DIR}/bin  )
   set(HEADER_STAGE_PATH ${STAGE_DIR}/include )
   set(SHARED_DATA_PATH ${STAGE_DIR}/share/openstructure  )
 
@@ -861,12 +873,12 @@ macro(setup_compiler_flags)
 
      add_definitions(-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_DEPRECATE
                      -D_SCL_SECURE_NO_DEPRECATE -DNOMINMAX)
-     add_definitions(-Zc:wchar_t-)   #
+     #add_definitions(-Zc:wchar_t-)   #
     # add_definitions(-MDd -vmg -EHsc -GR)
     #GR:Uses the __fastcall calling convention (x86 only).
     #-EHsc to specify the synchronous exception handling mode/
     #-vmg Uses full generality for pointers to members.
-    add_definitions(-DBOOST_ZLIB_BINARY=zdll)
+    #add_definitions(-DBOOST_ZLIB_BINARY=zdll)
     #add_definitions(-NODEFAULTLIB:LIBCMTD.lib)
   endif()
 
diff --git a/deployment/CMakeLists.txt b/deployment/CMakeLists.txt
index 19d084aec2979e7d898f2dfaebb4cab60f1135d0..7f455981bfe56bf0d5b0f3f20f2221e9fd13aa64 100644
--- a/deployment/CMakeLists.txt
+++ b/deployment/CMakeLists.txt
@@ -24,7 +24,7 @@ if(${PROJECT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
   elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
     include(linux/CMakeLists.txt) 
   elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
-    include(windows/CMakeLists.txt) 
+    include(win/CMakeLists.txt) 
   endif()
 
   INCLUDE(CPack) 
diff --git a/modules/base/src/stdint.hh b/modules/base/src/stdint.hh
index 282a564d9c618918f46a2b8d93f63c8bf5d8299e..5007525f7efb2c4a994348b8dfe7626f3ffe36a9 100644
--- a/modules/base/src/stdint.hh
+++ b/modules/base/src/stdint.hh
@@ -1,5 +1,9 @@
 #ifdef _MSC_VER
-#include <ost/stdint_msc.hh>
+  #if _MSC_VER >= 1600
+    #include <stdint.h>
+  #else
+    #include <ost/stdint_msc.hh>
+  #endif
 #else
 #include <stdint.h>
 #endif
diff --git a/modules/conop/src/CMakeLists.txt b/modules/conop/src/CMakeLists.txt
index 8f493e83e2a8daea025925fce3ac64b33cd7ea7a..1ae86c86f85c83aad9559a5811b6e99072309510 100644
--- a/modules/conop/src/CMakeLists.txt
+++ b/modules/conop/src/CMakeLists.txt
@@ -31,7 +31,12 @@ ring_finder.cc
 module(NAME conop SOURCES ${OST_CONOP_SOURCES}
        HEADERS ${OST_CONOP_HEADERS} DEPENDS_ON ost_mol ost_mol_alg ost_geom ost_db)
 
-executable(NAME chemdict_tool SOURCES chemdict_tool.cc DEPENDS_ON ost_io STATIC)
+
+if (WIN32)
+  executable(NAME chemdict_tool SOURCES chemdict_tool.cc ../../io/src/zlib.cpp ../../io/src/gzip.cpp DEPENDS_ON ost_io STATIC)
+else(WIN32)
+  executable(NAME chemdict_tool SOURCES chemdict_tool.cc DEPENDS_ON ost_io STATIC)
+endif(WIN32)
 
 if (COMPOUND_LIB)
   if (EXISTS "${COMPOUND_LIB}")
diff --git a/modules/db/src/CMakeLists.txt b/modules/db/src/CMakeLists.txt
index 8da34460be841e381308fcff5e6ca7e47cd59115..7d39362067e04933ceb279ea31ac044046ff106e 100644
--- a/modules/db/src/CMakeLists.txt
+++ b/modules/db/src/CMakeLists.txt
@@ -12,8 +12,9 @@ sqlite3.c
 
 module(NAME db SOURCES ${OST_DB_SOURCES} HEADERS ${OST_DB_HEADERS} 
        DEPENDS_ON ost_base)
-add_definitions(-DSQLITE_OMIT_LOAD_EXTENSION) 
 if(WIN32)
-  set_target_properties(ost_db PROPERTIES LINK_FLAGS "/DEF:sqlite3.def")
+  set_target_properties(ost_db PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/sqlite3.def")
   add_definitions(/DSQLITE_ENABLE_COLUMN_METADATA)
+else(WIN32)
+  add_definitions(-DSQLITE_OMIT_LOAD_EXTENSION)
 endif(WIN32)
diff --git a/modules/geom/src/vecmat3_op.hh b/modules/geom/src/vecmat3_op.hh
index 49d466081cb45b913dfb9b6ae2638f9a84030dcd..e13c2f07657c1c1489436b21f80b6e16b7e2a139 100644
--- a/modules/geom/src/vecmat3_op.hh
+++ b/modules/geom/src/vecmat3_op.hh
@@ -211,15 +211,15 @@ inline Real DistanceWithPBC(const Vec3& v1, const Vec3& v2, const Vec3& basis_ve
   return sqrt(Distance2WithPBC(v1, v2, basis_vec));
 }
 //! returns the minimal distance between the points in two Vec3List
-DLLEXPORT_OST_GEOM Real MinDistance(const Vec3List& l1, const Vec3List& l2);
+Real DLLEXPORT_OST_GEOM MinDistance(const Vec3List& l1, const Vec3List& l2);
 //! returns the minimal distance between the points in two Vec3List 
 //  with periodic boundaries in x,y,z given in basis_vec
-DLLEXPORT_OST_GEOM Real MinDistanceWithPBC(const Vec3List& l1, const Vec3List& l2, Vec3& basis_vec);
+Real DLLEXPORT_OST_GEOM MinDistanceWithPBC(const Vec3List& l1, const Vec3List& l2, Vec3& basis_vec);
 
 //!wraps a vector in a box with periodic boundaries
-DLLEXPORT_OST_GEOM Vec3 WrapVec3(const Vec3& v1,const Vec3& box_center,const Vec3& basis_vec);
-//!wraps all the vectors in a Vec3List in a box with periodic boundaries
-DLLEXPORT_OST_GEOM Vec3List WrapVec3List(const Vec3List& vl,const Vec3& box_center,const Vec3& basis_vec);
+Vec3 DLLEXPORT_OST_GEOM WrapVec3(const Vec3& v1,const Vec3& box_center,const Vec3& basis_vec);
+//!wraps all the verctors in a Vec3List in a box with periodic boundaries
+Vec3List DLLEXPORT_OST_GEOM WrapVec3List(const Vec3List& vl,const Vec3& box_center,const Vec3& basis_vec);
 
   
 } // ns
diff --git a/modules/geom/tests/test_composite2.cc b/modules/geom/tests/test_composite2.cc
index acec86fb900f5b32460c1cfb4fdb85855474b9be..612d73b0a13b3ef27f6ad86b88e0ffbcc72c6b0f 100644
--- a/modules/geom/tests/test_composite2.cc
+++ b/modules/geom/tests/test_composite2.cc
@@ -20,12 +20,12 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
 
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include "helper.hh"
 using namespace geom;
 
 BOOST_AUTO_TEST_SUITE( geom );
diff --git a/modules/geom/tests/test_composite3.cc b/modules/geom/tests/test_composite3.cc
index 317068280dd1a761c288e88b2a45e53089929547..a9fb6ea4d6bf4038c91450ac4b74f6edec35b8b8 100644
--- a/modules/geom/tests/test_composite3.cc
+++ b/modules/geom/tests/test_composite3.cc
@@ -20,14 +20,15 @@
 #include <cmath>
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
 
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 #include <boost/test/floating_point_comparison.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
 BOOST_AUTO_TEST_SUITE( geom );
 
 BOOST_AUTO_TEST_CASE(init_composite3)
diff --git a/modules/geom/tests/test_mat2.cc b/modules/geom/tests/test_mat2.cc
index 613b01ee0049fd800fabdfb10358a8f78273a1e9..c0f2e429f130a93186f9114e7275b5be9bbd3f23 100644
--- a/modules/geom/tests/test_mat2.cc
+++ b/modules/geom/tests/test_mat2.cc
@@ -19,13 +19,13 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
-
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
 BOOST_AUTO_TEST_SUITE( geom );
 
 
diff --git a/modules/geom/tests/test_mat3.cc b/modules/geom/tests/test_mat3.cc
index 381271a43a9b6d2d1a1968da7be6f1e7604dab99..7481e519e4bbf2d8b9c26943521fd73044a24bdd 100644
--- a/modules/geom/tests/test_mat3.cc
+++ b/modules/geom/tests/test_mat3.cc
@@ -19,13 +19,13 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
-
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
 BOOST_AUTO_TEST_SUITE( geom );
 
 BOOST_AUTO_TEST_CASE(init_mat3)
diff --git a/modules/geom/tests/test_mat4.cc b/modules/geom/tests/test_mat4.cc
index 2b3160dbf3cece9b9b58e685a0df3acf07dddd9d..64c0eff7a9efa0f9d2b06ca920f793ad9fa0e433 100644
--- a/modules/geom/tests/test_mat4.cc
+++ b/modules/geom/tests/test_mat4.cc
@@ -19,13 +19,13 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
-
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
 BOOST_AUTO_TEST_SUITE( geom );
 
 BOOST_AUTO_TEST_CASE(init_mat4)
diff --git a/modules/geom/tests/test_op2.cc b/modules/geom/tests/test_op2.cc
index 2815b3e65d3e99d74ea6ee780c240bd552ab1d25..fd52c6f3b32cb9d50ab370be1c99cf670e7dc78b 100644
--- a/modules/geom/tests/test_op2.cc
+++ b/modules/geom/tests/test_op2.cc
@@ -19,13 +19,13 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
-
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
 BOOST_AUTO_TEST_SUITE( geom );
 
 BOOST_AUTO_TEST_CASE(vecmat_mult2)
diff --git a/modules/geom/tests/test_op3.cc b/modules/geom/tests/test_op3.cc
index 1d4660b4e8cf92d2f6506bd900bad16aaf480dec..b37013a8c096bc5d2c90566f36ee9c26fa926377 100644
--- a/modules/geom/tests/test_op3.cc
+++ b/modules/geom/tests/test_op3.cc
@@ -19,13 +19,14 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
-
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
+
 BOOST_AUTO_TEST_SUITE( geom );
 
 BOOST_AUTO_TEST_CASE(vecmat_mult3)
diff --git a/modules/geom/tests/test_op4.cc b/modules/geom/tests/test_op4.cc
index df5995eca4b06298cd400111b6a4b46b952d9ee0..b9c4beeedfaa2e8e91693dbd86fbb17788a592d9 100644
--- a/modules/geom/tests/test_op4.cc
+++ b/modules/geom/tests/test_op4.cc
@@ -19,13 +19,14 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
-
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+
+#include "helper.hh"
+using namespace geom;
+
 BOOST_AUTO_TEST_SUITE( geom );
 
 BOOST_AUTO_TEST_CASE(vecmat_mult4)
diff --git a/modules/geom/tests/test_quat.cc b/modules/geom/tests/test_quat.cc
index cfd36460be4d09487e15000f2579cfdb78ed8697..54b8cea33e8ae65206d96dfcf35af88e43f19082 100644
--- a/modules/geom/tests/test_quat.cc
+++ b/modules/geom/tests/test_quat.cc
@@ -19,14 +19,15 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
-
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 #include <boost/test/floating_point_comparison.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
+
 BOOST_AUTO_TEST_SUITE( geom );
 
 BOOST_AUTO_TEST_CASE(init_quat)
diff --git a/modules/geom/tests/test_vec2.cc b/modules/geom/tests/test_vec2.cc
index db5d681737dcfe0067b6cbc4e47d5329d645922a..c7cb014de5378c0da4745ad327c260d48fe9c592 100644
--- a/modules/geom/tests/test_vec2.cc
+++ b/modules/geom/tests/test_vec2.cc
@@ -19,13 +19,13 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
-
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
 BOOST_AUTO_TEST_SUITE( geom );
   
 BOOST_AUTO_TEST_CASE(init_vec2)
diff --git a/modules/geom/tests/test_vec3.cc b/modules/geom/tests/test_vec3.cc
index 2d166b98825d0d46dc279e0b8273c250e541b80a..9b2a4cc8bb9919c1cee60581a11312ed8e76da57 100644
--- a/modules/geom/tests/test_vec3.cc
+++ b/modules/geom/tests/test_vec3.cc
@@ -19,13 +19,14 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
-
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
+
 BOOST_AUTO_TEST_SUITE( geom );
   
 BOOST_AUTO_TEST_CASE(init_vec3)
diff --git a/modules/geom/tests/test_vec4.cc b/modules/geom/tests/test_vec4.cc
index 665e2f168b5cc91ded628f38427c5b193ed57a08..f39988a41eef50063a77810c0e8ff5b08f785915 100644
--- a/modules/geom/tests/test_vec4.cc
+++ b/modules/geom/tests/test_vec4.cc
@@ -19,13 +19,14 @@
 
 #include <ost/geom/geom.hh>
 
-#include "helper.hh"
-using namespace geom;
 
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include "helper.hh"
+using namespace geom;
+
 BOOST_AUTO_TEST_SUITE( geom );
 
 BOOST_AUTO_TEST_CASE(init_vec4)
diff --git a/modules/gfx/src/color.cc b/modules/gfx/src/color.cc
index 43316f51c455e0643c7660274d10a5177177652b..60607ad0ed0fd0c85a0a67342b4b2929cfcbe426 100644
--- a/modules/gfx/src/color.cc
+++ b/modules/gfx/src/color.cc
@@ -263,7 +263,7 @@ Color& Color::operator/=(float rhs)
 
 void Color::to_rgb() const
 {
-  float hh=fmod(hsv_[0],1.0);
+  float hh=fmod(hsv_[0],1.0f);
   if(hh<0.0) hh+=1.0;
   float ss=std::min(1.0f,std::max(0.0f,hsv_[1]));
   float vv=std::min(1.0f,std::max(0.0f,hsv_[2]));
diff --git a/modules/gfx/src/color.hh b/modules/gfx/src/color.hh
index 6f0220bc2d2863c2744b502fee8c96dad21424ac..1340967f9b61d53d1aa4b5e307b0f9f560413d2d 100644
--- a/modules/gfx/src/color.hh
+++ b/modules/gfx/src/color.hh
@@ -159,7 +159,7 @@ private:
   mutable bool hsv_dirty_;
 };
 
-
+#undef RGB
 /// \brief RGB color spec from floats (0.0-1.0)
 Color DLLEXPORT_OST_GFX RGB(float r, float g, float b);
 
diff --git a/modules/gfx/src/gfx_prim.hh b/modules/gfx/src/gfx_prim.hh
index d3b97cec8bb5bf6c7b9c249d0ddaf23507151305..cb545425462042868a60be6b0a49c99adda6d065 100644
--- a/modules/gfx/src/gfx_prim.hh
+++ b/modules/gfx/src/gfx_prim.hh
@@ -74,18 +74,18 @@ struct CylinderPrim {
     calc_rotmat();
   }
 
-  CylinderPrim(const geom::Vec3& st, const geom::Vec3& en, float rad1, float rad2, const Color& col):
+  CylinderPrim(const geom::Vec3& st, const geom::Vec3& en, float radius_1, float radius_2, const Color& col):
     start(st), end(en),
-    radius1(rad1), radius2(rad2),
+    radius1(radius_1), radius2(radius_2),
     color1(col), color2(col),
     length(geom::Length(end-start)), rotmat(), rotmat_t() 
   {
     calc_rotmat();
   }
 
-  CylinderPrim(const geom::Vec3& st, const geom::Vec3& en, float rad1, float rad2, const Color& col1, const Color& col2):
+  CylinderPrim(const geom::Vec3& st, const geom::Vec3& en, float radius_1, float radius_2, const Color& col1, const Color& col2):
     start(st), end(en),
-    radius1(rad1), radius2(rad2),
+    radius1(radius_1), radius2(radius_2),
     color1(col1), color2(col2),
     length(geom::Length(end-start)), rotmat(), rotmat_t() 
   {
diff --git a/modules/gfx/src/prim_list.hh b/modules/gfx/src/prim_list.hh
index 80eabe333a1b9264da03f015d1f423905aa36f56..ec790dc9590d3346edaf74ef7f51a48653c16338 100644
--- a/modules/gfx/src/prim_list.hh
+++ b/modules/gfx/src/prim_list.hh
@@ -49,9 +49,9 @@ class DLLEXPORT_OST_GFX PrimList: public GfxObj
 
   struct LineEntry {
     LineEntry(const geom::Vec3& p1, const geom::Vec3& p2, float r1, float r2, const Color& c1, const Color& c2):
-      pos1(p1), pos2(p2), rad1(r1), rad2(r2), col1(c1), col2(c2) {}
+      pos1(p1), pos2(p2), radius_1(r1), radius_2(r2), col1(c1), col2(c2) {}
     geom::Vec3 pos1, pos2;
-    float rad1, rad2;
+    float radius_1, radius_2;
     Color col1, col2;
   };
 
diff --git a/modules/gfx/src/scene.cc b/modules/gfx/src/scene.cc
index 7ded8ad81e6465b92acaf2e371ac7f6ab8d8bad9..57faf873cc5ca163c9ccb1ded63c6a0be1c55c6b 100644
--- a/modules/gfx/src/scene.cc
+++ b/modules/gfx/src/scene.cc
@@ -2244,6 +2244,8 @@ void Scene::render_glow()
 #endif  
 }
 
+#undef far
+#undef near
 namespace {
   geom::Mat4 frustum(float left, float right, float bot, float top, float near, float far) {
     float rl=1.0/(right-left);
diff --git a/modules/gfx/src/texture.hh b/modules/gfx/src/texture.hh
index dd71404feb5f946a0965416546e7f57b42467fc3..aa3fec45f8f0a5d288d977dd290e40210a9c5253 100644
--- a/modules/gfx/src/texture.hh
+++ b/modules/gfx/src/texture.hh
@@ -32,7 +32,7 @@
 
 namespace ost { namespace gfx {
 
-class Bitmap;
+struct Bitmap;
 
 class Texture
 {
diff --git a/modules/gfx/src/vertex_array.cc b/modules/gfx/src/vertex_array.cc
index d37c83af141994eb83e638e1e0cb1ed5ca8b0024..520e0d0e9c95f640c3578b99af95090e7f4aabec 100644
--- a/modules/gfx/src/vertex_array.cc
+++ b/modules/gfx/src/vertex_array.cc
@@ -617,6 +617,7 @@ void IndexedVertexArray::Reset()
   outline_exp_factor_=0.1;
   outline_exp_color_=Color(0,0,0);
   solid_=false;
+  #undef RGB
   solid_color_=RGB(1,1,1);
   clip_offset_=0.0;
   draw_normals_=false;
diff --git a/modules/gfx/src/vertex_array.hh b/modules/gfx/src/vertex_array.hh
index 221c05ac956546940e1acf33e9e21fc19c0650e9..ac24ef85a01f8e6b0680af7d47729a7e154c4725 100644
--- a/modules/gfx/src/vertex_array.hh
+++ b/modules/gfx/src/vertex_array.hh
@@ -134,7 +134,7 @@ class DLLEXPORT_OST_GFX IndexedVertexArray {
   void SetSolid(bool f) {solid_=f;}
   bool GetSolid() const {return solid_;}
   void SetSolidColor(const Color& c) {solid_color_=c;}
-  bool GetSolidcolor() const {return solid_color_;}
+  Color GetSolidcolor() const {return solid_color_;}
   void SetClipOffset(float f) {clip_offset_=f;}
   float GetClipOffset() const {return clip_offset_;}
 
diff --git a/modules/gfx/tests/test_color.cc b/modules/gfx/tests/test_color.cc
index 88856fb1762fa5b636fc2f4ec449ea735865c62f..26784b4cc6bbac872aa3b4703564b1b3be8aeb95 100644
--- a/modules/gfx/tests/test_color.cc
+++ b/modules/gfx/tests/test_color.cc
@@ -36,13 +36,13 @@ static const float tolerance=1e-4;
 
 namespace {
   bool compare_colors(const Color& c1, const Color& c2, float tol=1e-6) {
-    return std::fabs(c1.GetRed()-c2.GetRed()<tol) &&
-      std::fabs(c1.GetGreen()-c2.GetGreen()<tol) &&
-      std::fabs(c1.GetBlue()-c2.GetBlue()<tol) &&
-      std::fabs(c1.GetAlpha()-c2.GetAlpha()<tol) &&
-      std::fabs(c1.GetHue()-c2.GetHue()<tol) &&
-      std::fabs(c1.GetSat()-c2.GetSat()<tol) &&
-      std::fabs(c1.GetVal()-c2.GetVal()<tol);
+    return std::abs<float>(c1.GetRed()-c2.GetRed()<tol) &&
+      std::abs<float>(c1.GetGreen()-c2.GetGreen()<tol) &&
+      std::abs<float>(c1.GetBlue()-c2.GetBlue()<tol) &&
+      std::abs<float>(c1.GetAlpha()-c2.GetAlpha()<tol) &&
+      std::abs<float>(c1.GetHue()-c2.GetHue()<tol) &&
+      std::abs<float>(c1.GetSat()-c2.GetSat()<tol) &&
+      std::abs<float>(c1.GetVal()-c2.GetVal()<tol);
   }
 }
 
diff --git a/modules/gui/src/CMakeLists.txt b/modules/gui/src/CMakeLists.txt
index b4d9ee6e433268164006b2c8806b1ebaf905e168..190cb6f6685b9643dfe54697786804ecc4df533f 100644
--- a/modules/gui/src/CMakeLists.txt
+++ b/modules/gui/src/CMakeLists.txt
@@ -476,12 +476,8 @@ include_directories(${PYTHON_INCLUDE_PATH})
 qt4_add_resources(OST_QT_RESOURCE dngr.qrc)
 qt4_wrap_cpp(OST_GOSTY_MOC "gosty.hh"
              OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
-# if someone has ANY idea why windows already has the boost program options
-# symbols defined, please talk to Marco and Juergen. You will be rewarded with
-# dogfood for a lifetime!
-if (NOT WIN32)
-  set(LINK LINK ${BOOST_PROGRAM_OPTIONS_LIBRARIES})
-endif()
+
+set(LINK LINK ${BOOST_PROGRAM_OPTIONS_LIBRARIES})
 
 executable_libexec(NAME gosty SOURCES gosty.cc ${OST_GOSTY_MOC} ${OST_QT_RESOURCE} 
            DEPENDS_ON ost_gui ${LINK})
diff --git a/modules/gui/src/gosty.cc b/modules/gui/src/gosty.cc
index 4fa44a3b4e4cb49b744a4e5d5ecc0bf6f0b65c76..ad13d07b313a2a018c66cbe4a0aee89d0579097f 100644
--- a/modules/gui/src/gosty.cc
+++ b/modules/gui/src/gosty.cc
@@ -96,8 +96,6 @@ String get_ost_root()
 #else
   #ifdef _MSC_VER
     dir.cdUp();
-    dir.cdUp();
-    dir.cdUp();
   #else
     dir.cdUp();
     dir.cdUp();
@@ -227,6 +225,9 @@ public:
 
 }
 
+#ifdef _MSC_VER
+  #pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
+#endif
 // initialise gosty - the graphical open structure interpreter
 int main(int argc, char** argv)
 {
diff --git a/modules/img/alg/src/stat_accumulator.hh b/modules/img/alg/src/stat_accumulator.hh
index a07d6219e5dae160cb8198f611d5b38e0ccd4838..53399f8be99c0cb4e1a445b38aabfd7252bb4c41 100644
--- a/modules/img/alg/src/stat_accumulator.hh
+++ b/modules/img/alg/src/stat_accumulator.hh
@@ -27,7 +27,7 @@
 namespace ost { namespace img { namespace alg {
 
 template<unsigned int MAX_MOMENT=4>
-class DLLEXPORT_IMG_ALG StatAccumulator
+class  StatAccumulator
 {
 public:
   StatAccumulator():
@@ -70,14 +70,14 @@ public:
     sum2_+=val*val;
   }
 
-  StatAccumulator operator+(const StatAccumulator& acc2) const
+  StatAccumulator<MAX_MOMENT> operator+(const StatAccumulator<MAX_MOMENT>& acc2) const
   {
-    StatAccumulator acc(acc2);
+    StatAccumulator<MAX_MOMENT> acc(acc2);
     acc+=*this;
     return acc;
   }
 
-  StatAccumulator& operator+=(const StatAccumulator& acc)
+  StatAccumulator<MAX_MOMENT>& operator+=(const StatAccumulator<MAX_MOMENT>& acc)
   {
     if(acc.n_==1){
       return *this;
diff --git a/modules/img/base/src/image_state/image_state_impl.hh b/modules/img/base/src/image_state/image_state_impl.hh
index d18989aaa3f6722617b01893fc765a6603bdfa25..e3a70ae93ca6b402b4d708189b97742d51855207 100644
--- a/modules/img/base/src/image_state/image_state_impl.hh
+++ b/modules/img/base/src/image_state/image_state_impl.hh
@@ -81,7 +81,7 @@ public:
   // image state base interface
   virtual ImageStateBasePtr Clone(bool cc=true) const;
   
-  virtual size_t MemSize() const;
+  virtual std::size_t MemSize() const;
 
   virtual DataType GetType() const;
 
@@ -168,10 +168,10 @@ public:
   const T& Value(const Index& i) const;
 
   // pass-through to value holder
-  T& Value(size_t i);
+  T& Value(std::size_t i);
 
   // pass-through to value holder
-  const T& Value(size_t i) const;
+  const T& Value(std::size_t i) const;
 
   //! direct access to value holder
   ValueHolder<T>& Data();
diff --git a/modules/img/base/src/image_state/value_holder.cc b/modules/img/base/src/image_state/value_holder.cc
index aafae4b5412428571a0e0f24bcfde72443cd58fd..b17acccbc93758dfaca5b0fda583e2f8569b0953 100644
--- a/modules/img/base/src/image_state/value_holder.cc
+++ b/modules/img/base/src/image_state/value_holder.cc
@@ -42,7 +42,7 @@ namespace ost { namespace img { namespace image_state {
 namespace {
 
 template <typename V>
-size_t calc_volume(const Size& s)
+std::size_t calc_volume(const Size& s)
 {
   unsigned int tmp;
   unsigned int numbits = 0;
@@ -67,11 +67,11 @@ size_t calc_volume(const Size& s)
   {
     ++numbits;
   }
-  // check if number of pixels (2**(numbits+1)) larger than what size_t can handle
-  if(numbits>=sizeof(size_t)*8){
+  // check if number of pixels (2**(numbits+1)) larger than what std::size_t can handle
+  if(numbits>=sizeof(std::size_t)*8){
       throw std::bad_alloc();
   }
-  return static_cast<size_t>(s[0])*static_cast<size_t>(s[1])*static_cast<size_t>(s[2]);
+  return static_cast<std::size_t>(s[0])*static_cast<std::size_t>(s[1])*static_cast<std::size_t>(s[2]);
 }
 
 } //ns
@@ -183,7 +183,7 @@ DataType ValueHolder<V>::GetDataType()
 }
 
 template <typename V>
-size_t ValueHolder<V>::MemSize() const
+std::size_t ValueHolder<V>::MemSize() const
 {
   return sizeof(V)*data_.size();
 }
diff --git a/modules/img/base/src/image_state/value_holder.hh b/modules/img/base/src/image_state/value_holder.hh
index 6caa155cc9fe254dd962d198685347aa60de1e22..cb154c2e16f968b40141aa511d00e9a9b9bdf226 100644
--- a/modules/img/base/src/image_state/value_holder.hh
+++ b/modules/img/base/src/image_state/value_holder.hh
@@ -95,7 +95,7 @@ public:
 
   static DataType GetDataType();
 
-  size_t  MemSize() const;
+  std::size_t  MemSize() const;
 
 
 
@@ -124,11 +124,11 @@ public:
 
 private:
 #ifdef USE_ROW_ORDER
-  size_t depth_;
-  size_t height_depth_;
+  std::size_t depth_;
+  std::size_t height_depth_;
 #else
-  size_t height_;
-  size_t width_height_;
+  std::size_t height_;
+  std::size_t width_height_;
 #endif
 
   // actual data storage
diff --git a/modules/io/src/CMakeLists.txt b/modules/io/src/CMakeLists.txt
index c2a465686698258543707f91b5097e7d5f98ff11..58470a33136c2b794668dc2b39effab39cd2f805 100644
--- a/modules/io/src/CMakeLists.txt
+++ b/modules/io/src/CMakeLists.txt
@@ -22,7 +22,9 @@ io_manager.cc
 convert.cc
 io_utils.cc
 )
-
+if (WIN32)
+ set(OST_IO_SOURCES ${OST_IO_SOURCES} zlib.cpp gzip.cpp)
+endif(WIN32)
 
 foreach(fname ${OST_IO_MOL_SOURCES})
   set(OST_IO_SOURCES ${OST_IO_SOURCES} mol/${fname})
@@ -61,10 +63,7 @@ module(NAME io SOURCES "${OST_IO_SOURCES}"
                ${OST_IO_SEQ_HEADERS} IN_DIR seq            
                ${OST_IO_HEADERS} 
        DEPENDS_ON ${OST_IO_DEPENDENCIES})
-if (NOT WIN32)
-  # see note in modules/gui/src/CMakeLists.txt
-  target_link_libraries(ost_io ${BOOST_IOSTREAM_LIBRARIES})
-endif()
+target_link_libraries(ost_io ${BOOST_IOSTREAM_LIBRARIES})
 if (ENABLE_IMG)
   target_link_libraries(ost_io ${TIFF_LIBRARIES} ${PNG_LIBRARIES})
 endif()
\ No newline at end of file
diff --git a/modules/io/src/gzip.cpp b/modules/io/src/gzip.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..04cb71a54dde7568c4921fc76241202fab6e075c
--- /dev/null
+++ b/modules/io/src/gzip.cpp
@@ -0,0 +1,174 @@
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2003-2007 Jonathan Turkanis
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+// To configure Boost to work with libbz2, see the 
+// installation instructions here:
+// http://boost.org/libs/iostreams/doc/index.html?path=7
+
+// Define BOOST_IOSTREAMS_SOURCE so that <boost/iostreams/detail/config.hpp> 
+// knows that we are building the library (possibly exporting code), rather 
+// than using it (possibly importing code).
+#define BOOST_IOSTREAMS_SOURCE 
+
+#include <boost/iostreams/detail/config/dyn_link.hpp>
+#include <boost/iostreams/filter/gzip.hpp>
+#include <boost/throw_exception.hpp>
+
+namespace boost { namespace iostreams {
+
+//------------------Implementation of gzip_header-----------------------------//
+
+namespace detail {
+
+void gzip_header::process(char c)
+{
+    uint8_t value = static_cast<uint8_t>(c);
+    switch (state_) {
+    case s_id1:
+        if (value != gzip::magic::id1)
+            boost::throw_exception(gzip_error(gzip::bad_header));
+        state_ = s_id2;
+        break;
+    case s_id2:
+        if (value != gzip::magic::id2)
+            boost::throw_exception(gzip_error(gzip::bad_header));
+        state_ = s_cm;
+        break;
+    case s_cm:
+        if (value != gzip::method::deflate)
+            boost::throw_exception(gzip_error(gzip::bad_method));
+        state_ = s_flg;
+        break;
+    case s_flg:
+        flags_ = value;
+        state_ = s_mtime;
+        break;
+    case s_mtime:
+        mtime_ += value << (offset_ * 8);
+        if (offset_ == 3) {
+            state_ = s_xfl;
+            offset_ = 0;
+        } else {
+            ++offset_;
+        }
+        break;
+    case s_xfl:
+        state_ = s_os;
+        break;
+    case s_os:
+        os_ = value;
+        if (flags_ & gzip::flags::extra) {
+            state_ = s_extra;
+        } else if (flags_ & gzip::flags::name) {
+            state_ = s_name;
+        } else if (flags_ & gzip::flags::comment) {
+            state_ = s_comment;
+        } else if (flags_ & gzip::flags::header_crc) {
+            state_ = s_hcrc;
+        } else {
+            state_ = s_done;
+        }
+        break;
+    case s_xlen:
+        xlen_ += value << (offset_ * 8);
+        if (offset_ == 1) {
+            state_ = s_extra;
+            offset_ = 0;
+        } else {
+            ++offset_;
+        }
+        break;
+    case s_extra:
+        if (--xlen_ == 0) {
+            if (flags_ & gzip::flags::name) {
+                state_ = s_name;
+            } else if (flags_ & gzip::flags::comment) {
+                state_ = s_comment;
+            } else if (flags_ & gzip::flags::header_crc) {
+                state_ = s_hcrc;
+            } else {
+                state_ = s_done;
+            }
+        }
+        break;
+    case s_name:
+        if (c != 0) {
+            file_name_ += c;
+        } else if (flags_ & gzip::flags::comment) {
+            state_ = s_comment;
+        } else if (flags_ & gzip::flags::header_crc) {
+            state_ = s_hcrc;
+        } else {
+            state_ = s_done;
+        }
+        break;
+    case s_comment:
+        if (c != 0) {
+            comment_ += c;
+        } else if (flags_ & gzip::flags::header_crc) {
+            state_ = s_hcrc;
+        } else {
+            state_ = s_done;
+        }
+        break;
+    case s_hcrc:
+        if (offset_ == 1) {
+            state_ = s_done;
+            offset_ = 0;
+        } else {
+            ++offset_;
+        }
+        break;
+    default:
+        BOOST_ASSERT(0);
+    }
+}
+
+void gzip_header::reset()
+{
+    file_name_.clear();
+    comment_.clear();
+    os_ = flags_ = offset_ = xlen_ = 0;
+    mtime_ = 0;
+    state_ = s_id1;
+}
+
+//------------------Implementation of gzip_footer-----------------------------//
+
+void gzip_footer::process(char c)
+{
+    uint8_t value = static_cast<uint8_t>(c);
+    if (state_ == s_crc) {
+        crc_ += value << (offset_ * 8);
+        if (offset_ == 3) {
+            state_ = s_isize;
+            offset_ = 0;
+        } else {
+            ++offset_;
+        }
+    } else if (state_ == s_isize) {
+        isize_ += value << (offset_ * 8);
+        if (offset_ == 3) {
+            state_ = s_done;
+            offset_ = 0;
+        } else {
+            ++offset_;
+        }
+    } else {
+        BOOST_ASSERT(0);
+    }
+}
+
+void gzip_footer::reset()
+{
+    crc_ = isize_ = offset_ = 0;
+    state_ = s_crc;
+}
+
+} // End namespace boost::iostreams::detail.
+
+} } // End namespaces iostreams, boost.
diff --git a/modules/io/src/zlib.cpp b/modules/io/src/zlib.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d765e855df48fce940be0bca71d373cd7074f0a4
--- /dev/null
+++ b/modules/io/src/zlib.cpp
@@ -0,0 +1,193 @@
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2003-2007 Jonathan Turkanis
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+// To configure Boost to work with zlib, see the 
+// installation instructions here:
+// http://boost.org/libs/iostreams/doc/index.html?path=7
+
+// Define BOOST_IOSTREAMS_SOURCE so that <boost/iostreams/detail/config.hpp> 
+// knows that we are building the library (possibly exporting code), rather 
+// than using it (possibly importing code).
+#define BOOST_IOSTREAMS_SOURCE 
+
+#include <boost/throw_exception.hpp>
+#include <boost/iostreams/detail/config/dyn_link.hpp>
+#include <boost/iostreams/filter/zlib.hpp> 
+#include "zlib.h"   // Jean-loup Gailly's and Mark Adler's "zlib.h" header.
+                    // To configure Boost to work with zlib, see the 
+                    // installation instructions here:
+                    // http://boost.org/libs/iostreams/doc/index.html?path=7
+
+namespace boost { namespace iostreams {
+
+namespace zlib {
+
+                    // Compression levels
+
+const int no_compression       = Z_NO_COMPRESSION;
+const int best_speed           = Z_BEST_SPEED;
+const int best_compression     = Z_BEST_COMPRESSION;
+const int default_compression  = Z_DEFAULT_COMPRESSION;
+
+                    // Compression methods
+
+const int deflated             = Z_DEFLATED;
+
+                    // Compression strategies
+
+const int default_strategy     = Z_DEFAULT_STRATEGY;
+const int filtered             = Z_FILTERED;
+const int huffman_only         = Z_HUFFMAN_ONLY;
+
+                    // Status codes
+
+const int okay                 = Z_OK;
+const int stream_end           = Z_STREAM_END;
+const int stream_error         = Z_STREAM_ERROR;
+const int version_error        = Z_VERSION_ERROR;
+const int data_error           = Z_DATA_ERROR;
+const int mem_error            = Z_MEM_ERROR;
+const int buf_error            = Z_BUF_ERROR;
+
+                    // Flush codes
+
+const int finish               = Z_FINISH;
+const int no_flush             = Z_NO_FLUSH;
+const int sync_flush           = Z_SYNC_FLUSH;
+
+                    // Code for current OS
+
+//const int os_code              = OS_CODE;
+
+} // End namespace zlib. 
+
+//------------------Implementation of zlib_error------------------------------//
+                    
+zlib_error::zlib_error(int error) 
+    : BOOST_IOSTREAMS_FAILURE("zlib error"), error_(error) 
+    { }
+
+void zlib_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(int error)
+{
+    switch (error) {
+    case Z_OK: 
+    case Z_STREAM_END: 
+    //case Z_BUF_ERROR: 
+        return;
+    case Z_MEM_ERROR: 
+        boost::throw_exception(std::bad_alloc());
+    default:
+        boost::throw_exception(zlib_error(error));
+        ;
+    }
+}
+
+//------------------Implementation of zlib_base-------------------------------//
+
+namespace detail {
+
+zlib_base::zlib_base()
+    : stream_(new z_stream), calculate_crc_(false), crc_(0), crc_imp_(0)
+    { }
+
+zlib_base::~zlib_base() { delete static_cast<z_stream*>(stream_); }
+
+void zlib_base::before( const char*& src_begin, const char* src_end,
+                        char*& dest_begin, char* dest_end )
+{
+    z_stream* s = static_cast<z_stream*>(stream_);
+    s->next_in = reinterpret_cast<zlib::byte*>(const_cast<char*>(src_begin));
+    s->avail_in = static_cast<zlib::uint>(src_end - src_begin);
+    s->next_out = reinterpret_cast<zlib::byte*>(dest_begin);
+    s->avail_out= static_cast<zlib::uint>(dest_end - dest_begin);
+}
+
+void zlib_base::after(const char*& src_begin, char*& dest_begin, bool compress)
+{
+    z_stream* s = static_cast<z_stream*>(stream_);
+    char* next_in = reinterpret_cast<char*>(s->next_in);
+    char* next_out = reinterpret_cast<char*>(s->next_out);
+    if (calculate_crc_) {
+        const zlib::byte* buf = compress ?
+            reinterpret_cast<const zlib::byte*>(src_begin) :
+            reinterpret_cast<const zlib::byte*>(
+                const_cast<const char*>(dest_begin)
+            );
+        zlib::uint length = compress ?
+            static_cast<zlib::uint>(next_in - src_begin) :
+            static_cast<zlib::uint>(next_out - dest_begin);
+        if (length > 0)
+            crc_ = crc_imp_ = crc32(crc_imp_, buf, length);
+    }
+    total_in_ = s->total_in;
+    total_out_ = s->total_out;
+    src_begin = const_cast<const char*>(next_in);
+    dest_begin = next_out;
+}
+
+int zlib_base::xdeflate(int flush)
+{ 
+    return ::deflate(static_cast<z_stream*>(stream_), flush);
+}
+
+int zlib_base::xinflate(int flush)
+{ 
+    return ::inflate(static_cast<z_stream*>(stream_), flush);
+}
+
+void zlib_base::reset(bool compress, bool realloc)
+{
+    z_stream* s = static_cast<z_stream*>(stream_);
+    // Undiagnosed bug:
+    // deflateReset(), etc., return Z_DATA_ERROR
+    //zlib_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(
+        realloc ?
+            (compress ? deflateReset(s) : inflateReset(s)) :
+            (compress ? deflateEnd(s) : inflateEnd(s))
+                ;
+    //);
+    crc_imp_ = 0;
+}
+
+void zlib_base::do_init
+    ( const zlib_params& p, bool compress, 
+      #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+          zlib::xalloc_func /* alloc */, zlib::xfree_func /* free*/, 
+      #endif
+      void* derived )
+{
+    calculate_crc_ = p.calculate_crc;
+    z_stream* s = static_cast<z_stream*>(stream_);
+
+    // Current interface for customizing memory management 
+    // is non-conforming and has been disabled:
+    //#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+    //    s->zalloc = alloc;
+    //    s->zfree = free;
+    //#else
+        s->zalloc = 0;
+        s->zfree = 0;
+    //#endif
+    s->opaque = derived;
+    int window_bits = p.noheader? -p.window_bits : p.window_bits;
+    zlib_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(
+        compress ?
+            deflateInit2( s, 
+                          p.level,
+                          p.method,
+                          window_bits,
+                          p.mem_level,
+                          p.strategy ) :
+            inflateInit2(s, window_bits)
+    );
+}
+
+} // End namespace detail.
+
+//----------------------------------------------------------------------------//
+
+} } // End namespaces iostreams, boost.
diff --git a/modules/io/tests/test_clustal.cc b/modules/io/tests/test_clustal.cc
index 0f8b4d63bd56e0aa4f51acba6dcb18c64b273bd6..b9ebf221b655b00c6c1a50b23d74685cfd389169 100644
--- a/modules/io/tests/test_clustal.cc
+++ b/modules/io/tests/test_clustal.cc
@@ -21,12 +21,13 @@
   Author: Marco Biasini
  */
 
-#include <ost/io/seq/clustal_io_handler.hh>
-#include <ost/io/seq/load.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include <ost/io/seq/clustal_io_handler.hh>
+#include <ost/io/seq/load.hh>
+
 using namespace ost;
 using namespace ost::io;
 const static String MOUSE="MFQAFPGDYDSGSRCSSSPSAESQYLSSVDSFGSPPTAAASQECAGLGEMPGSFVPTVTAITTSQDLQWLVQPTLISSMAQSQGQPLASQPPAVDPYDMPGTSYSTPGLSAYSTGGASGS";
diff --git a/modules/io/tests/test_io_crd.cc b/modules/io/tests/test_io_crd.cc
index 5fa943c87bd1cc942c0cf5b9dc1053ce15099a42..b317e936bce58126c130f2260c318af8112a7422 100644
--- a/modules/io/tests/test_io_crd.cc
+++ b/modules/io/tests/test_io_crd.cc
@@ -16,13 +16,14 @@
 // along with this library; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+
 #include <ost/test_utils/compare_files.hh>
 #include <ost/mol/mol.hh>
 #include <ost/io/mol/entity_io_crd_handler.hh>
 #include <ost/io/save_entity.hh>
-#define BOOST_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
-#include <boost/test/auto_unit_test.hpp>
 
 using namespace ost;
 using namespace ost::io;
diff --git a/modules/io/tests/test_io_dcd.cc b/modules/io/tests/test_io_dcd.cc
index b326d381b68d15f4bf61c80df65ddc06f5446f11..016555e696f569175ff066ffef96ed43abdddb52 100644
--- a/modules/io/tests/test_io_dcd.cc
+++ b/modules/io/tests/test_io_dcd.cc
@@ -17,6 +17,10 @@
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
 
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+
 #include <ost/io/mol/dcd_io.hh>
 #include <ost/mol/entity_handle.hh>
 #include <ost/mol/residue_handle.hh>
@@ -24,9 +28,6 @@
 #include <ost/mol/atom_handle.hh>
 #include <ost/mol/xcs_editor.hh>
 #include <ost/mol/coord_group.hh>
-#define BOOST_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
-#include <boost/test/auto_unit_test.hpp>
 
 using namespace ost;
 using namespace ost::io;
diff --git a/modules/io/tests/test_io_img.cc b/modules/io/tests/test_io_img.cc
index 890a7a9c29a22beb57b4c7c0aa0ffb04273f8777..78093264b4b204fd095152fff381ae0ac5419512 100644
--- a/modules/io/tests/test_io_img.cc
+++ b/modules/io/tests/test_io_img.cc
@@ -16,12 +16,14 @@
 // along with this library; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+
 #include <map>
 #include <ost/io/load_map.hh>
 #include <ost/img/image_factory.hh>
 #include <ost/img/alg/randomize.hh>
-#define BOOST_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
 #include  <ost/io/img/map_io_df3_handler.hh>
 #include  <ost/io/img/map_io_dat_handler.hh>
 #include  <ost/io/img/map_io_dx_handler.hh>
diff --git a/modules/io/tests/test_io_pdb.cc b/modules/io/tests/test_io_pdb.cc
index 9b5b6691f6a9410a943bc4ea5850e3e261513d2a..9268778ff080c3eb4b9ad071a492fe16bd9f5735 100644
--- a/modules/io/tests/test_io_pdb.cc
+++ b/modules/io/tests/test_io_pdb.cc
@@ -16,6 +16,12 @@
 // along with this library; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+using boost::unit_test_framework::test_suite;
+
 #include <ost/test_utils/compare_files.hh>
 #include <ost/geom/vec_mat_predicates.hh>
 
@@ -31,11 +37,6 @@
 #include <ost/log.hh>
 
 #include <ost/io/io_exception.hh>
-#define BOOST_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
-#include <boost/test/auto_unit_test.hpp>
-#include <boost/test/floating_point_comparison.hpp>
-using boost::unit_test_framework::test_suite;
 
 using namespace ost;
 using namespace ost::io;
diff --git a/modules/io/tests/test_io_sdf.cc b/modules/io/tests/test_io_sdf.cc
index dcf7df6daf7afb4d5ea08bd6a19b1236f9128d91..289bdfea3a7a79247a762cb7a300eab4c6957910 100644
--- a/modules/io/tests/test_io_sdf.cc
+++ b/modules/io/tests/test_io_sdf.cc
@@ -16,11 +16,6 @@
 // along with this library; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
-#include <ost/test_utils/compare_files.hh>
-#include <ost/mol/mol.hh>
-#include <ost/io/mol/entity_io_sdf_handler.hh>
-#include <ost/io/save_entity.hh>
-#include <ost/io/io_exception.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/floating_point_comparison.hpp>
@@ -29,6 +24,12 @@
 #include <boost/algorithm/string.hpp>
 using boost::unit_test_framework::test_suite;
 
+#include <ost/test_utils/compare_files.hh>
+#include <ost/mol/mol.hh>
+#include <ost/io/mol/entity_io_sdf_handler.hh>
+#include <ost/io/save_entity.hh>
+#include <ost/io/io_exception.hh>
+
 using namespace ost;
 using namespace ost::io;
 
diff --git a/modules/io/tests/test_iomanager.cc b/modules/io/tests/test_iomanager.cc
index fc4cc0366b2a640aafbd8f569951886b78adef9f..b6e79f1fc6cda5ffc73a4990e23def87d2c5c96d 100644
--- a/modules/io/tests/test_iomanager.cc
+++ b/modules/io/tests/test_iomanager.cc
@@ -16,11 +16,11 @@
 // along with this library; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
-#include <ost/io/io_manager.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 using boost::unit_test_framework::test_suite;
+#include <ost/io/io_manager.hh>
 
 
 using namespace ost;
diff --git a/modules/io/tests/test_mmcif_info.cc b/modules/io/tests/test_mmcif_info.cc
index 3f3e21baf4b8a9e3f10b8f65380338668015bfd3..74fca9b43f5d63beeb884c12a51698c13efffa97 100644
--- a/modules/io/tests/test_mmcif_info.cc
+++ b/modules/io/tests/test_mmcif_info.cc
@@ -17,14 +17,14 @@
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
 
-#include <ost/io/io_exception.hh>
-#include <ost/io/mol/mmcif_info.hh>
-
-#define BOOST_AUTO_TEST_DYN_LINK
+#define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 #include <boost/test/floating_point_comparison.hpp>
 
+#include <ost/io/io_exception.hh>
+#include <ost/io/mol/mmcif_info.hh>
+
 using namespace ost;
 using namespace ost::io;
 
diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc
index 76125e41d2fc42b52f577c905a153575fa5339f2..67ef53d8754fecc59ad3a7f61e87fdb755c61c02 100644
--- a/modules/io/tests/test_mmcif_reader.cc
+++ b/modules/io/tests/test_mmcif_reader.cc
@@ -17,6 +17,11 @@
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
 
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
 #include <fstream>
 #include <ost/platform.hh>
 #include <ost/io/io_exception.hh>
@@ -24,10 +29,6 @@
 #include <ost/conop/conop.hh>
 #include <ost/conop/rule_based_builder.hh>
 
-#define BOOST_AUTO_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
-#include <boost/test/auto_unit_test.hpp>
-#include <boost/test/floating_point_comparison.hpp>
 
 
 using namespace ost;
diff --git a/modules/io/tests/test_star_parser.cc b/modules/io/tests/test_star_parser.cc
index 5561dd89203f14d29c45c0ba3655c1fb15919aed..4d611807830aabf0b7b24725a708f3f99d81af04 100644
--- a/modules/io/tests/test_star_parser.cc
+++ b/modules/io/tests/test_star_parser.cc
@@ -19,16 +19,17 @@
 /*
   Author: Marco Biasini
  */
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
 #include <fstream>
 #include <math.h>
 #include <ost/mol/mol.hh>
 #include <ost/io/io_exception.hh>
 #include <ost/io/mol/star_parser.hh>
 
-#define BOOST_AUTO_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
-#include <boost/test/auto_unit_test.hpp>
-#include <boost/test/floating_point_comparison.hpp>
 
 
 using namespace ost;
diff --git a/modules/mol/alg/src/entity_to_density.cc b/modules/mol/alg/src/entity_to_density.cc
index a01bd49c173f2f9c6ad2a76ac7c0465df49edfe2..118653ccedcfefb53b66be9f1e420d3926ae1d5f 100644
--- a/modules/mol/alg/src/entity_to_density.cc
+++ b/modules/mol/alg/src/entity_to_density.cc
@@ -123,7 +123,7 @@ public:
     uint y_limit = ceil(falloff_end_frequency_ / frequency_sampling[1]);
     uint z_limit = ceil(falloff_end_frequency_ / frequency_sampling[2]);
      img::Extent reduced_extent = img::Extent
-             (img::Point(-x_limit,-y_limit,0),
+             (img::Point(-static_cast<int>(x_limit),-static_cast<int>(y_limit),0),
               img::Point(x_limit,y_limit,z_limit));
 
     mol::AtomViewIter iterator_end = entity_view_.AtomsEnd();
diff --git a/modules/mol/alg/src/trajectory_analysis.cc b/modules/mol/alg/src/trajectory_analysis.cc
index 1ef9b565142bc48336dc4c76e1ce7e4e37100539..96dd5fabb0599b77fb68fa4d9ca8dea94a8de313 100644
--- a/modules/mol/alg/src/trajectory_analysis.cc
+++ b/modules/mol/alg/src/trajectory_analysis.cc
@@ -331,7 +331,7 @@ std::vector<Real> AnalyzeAromaticRingInteraction(const CoordGroupHandle& traj, c
     if (to<from) {
       throw Error("to smaller than from");
     }
-    unsigned int n_frames=ceil((to-from)/stride);
+    unsigned int n_frames=ceil((to-from)/static_cast<Real>(stride));
     if (n_atoms==0){
       throw Error("EntityView is empty");
     }
@@ -370,7 +370,7 @@ std::vector<Real> AnalyzeAromaticRingInteraction(const CoordGroupHandle& traj, c
     if (to<from) {
       throw Error("to smaller than from");
     }
-    unsigned int n_frames=ceil((to-from)/stride);
+    unsigned int n_frames=ceil((to-from)/static_cast<Real>(stride));
     if (n_atoms==0){
       throw Error("EntityView is empty");
     }
diff --git a/modules/mol/alg/tests/test_consistency_checks.cc b/modules/mol/alg/tests/test_consistency_checks.cc
index aad198febf3decc69d591cb16058cfe9d6e07a24..b7e3d3e4cc4742fb7df7bf28ec87287396b93a4a 100644
--- a/modules/mol/alg/tests/test_consistency_checks.cc
+++ b/modules/mol/alg/tests/test_consistency_checks.cc
@@ -20,7 +20,7 @@
 /*
  * Author Valerio Mariani
  */
-#define BOOST_TEST_MODULE ost_mol_alg
+#define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
diff --git a/modules/mol/base/src/chain_type.hh b/modules/mol/base/src/chain_type.hh
index 513cb1d51b3c295376d4b7094844b58967091336..82d9115f9d1653c579ec49d5538dc29399eb0551 100644
--- a/modules/mol/base/src/chain_type.hh
+++ b/modules/mol/base/src/chain_type.hh
@@ -19,6 +19,7 @@
 #ifndef OST_CHAIN_TYPE_HH
 #define OST_CHAIN_TYPE_HH
 
+#include <ost/mol/module_config.hh>
 #include <ost/base.hh>
 #include <ost/string_ref.hh>
 
diff --git a/modules/mol/base/src/coord_frame.hh b/modules/mol/base/src/coord_frame.hh
index b7cce0661ef615db5799e0dfe287d0d0187cb74c..e624ebf87065849c87c169249f7994a892e1bf75 100644
--- a/modules/mol/base/src/coord_frame.hh
+++ b/modules/mol/base/src/coord_frame.hh
@@ -22,6 +22,7 @@
 /*
   Authors: Marco Biasini, Niklaus Johner, Ansgar Philippsen
  */
+#include <ost/mol/module_config.hh>
 #include <boost/shared_ptr.hpp>
 #include <ost/geom/geom.hh>
 #include <ost/mol/module_config.hh>
diff --git a/modules/mol/base/src/entity_view.cc b/modules/mol/base/src/entity_view.cc
index 3a9918cde865d2a171fd687487c4a7f751be6756..0c2d6db4177c6259fc3e39b3de91afd81ae7ad58 100644
--- a/modules/mol/base/src/entity_view.cc
+++ b/modules/mol/base/src/entity_view.cc
@@ -252,7 +252,7 @@ ChainView EntityView::FindChain(const String& chain_name) const{
   this->CheckValidity();
   ChainViewList::const_iterator i;
   i=std::find_if(data_->chains.begin(), data_->chains.end(),
-                 bind(&ChainView::GetName, _1)==chain_name);
+                 boost::bind(&ChainView::GetName, _1)==chain_name);
   return (i!=data_->chains.end()) ? *i : ChainView();
 }
 
diff --git a/modules/mol/base/src/residue_view.cc b/modules/mol/base/src/residue_view.cc
index 21eea91de4f4ae8d5dcdd1348454321cad3252ba..15caa6bd5e0acfc00c691d5042ea0fb77aafa5a7 100644
--- a/modules/mol/base/src/residue_view.cc
+++ b/modules/mol/base/src/residue_view.cc
@@ -114,7 +114,7 @@ AtomView ResidueView::FindAtom(const String& atom_name) const {
   this->CheckValidity();
   const AtomViewList& l=data_->atoms;
   AtomViewList::const_iterator i;
-  i=std::find_if(l.begin(), l.end(), bind(&AtomView::GetName, _1)==atom_name);
+  i=std::find_if(l.begin(), l.end(), boost::bind(&AtomView::GetName, _1)==atom_name);
   return i==data_->atoms.end() ? AtomView() : *i;
 }
 
diff --git a/modules/mol/base/tests/test_atom_groups.cc b/modules/mol/base/tests/test_atom_groups.cc
index fd55845fe2fb550df4545842f0ac92bdf53f3b1c..7514f57acfd0242a20ecfb64aba55cb6f9b79e3f 100644
--- a/modules/mol/base/tests/test_atom_groups.cc
+++ b/modules/mol/base/tests/test_atom_groups.cc
@@ -19,11 +19,11 @@
 /*
  *  Authors: Marco Biasini, Juergen Haas
  */
-#include <ost/mol/mol.hh>
-#include <ost/message.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
+#include <ost/mol/mol.hh>
+#include <ost/message.hh>
 #include "dummy_ent.hh"
 
 
diff --git a/modules/mol/base/tests/test_chain.cc b/modules/mol/base/tests/test_chain.cc
index 39ffd35e205cd320cc926af7e4a440f838109b2c..c857cce0989b9a75b65c0c191e8c57cbe63a687c 100644
--- a/modules/mol/base/tests/test_chain.cc
+++ b/modules/mol/base/tests/test_chain.cc
@@ -19,13 +19,14 @@
 /*
  *  Authors: Marco Biasini, Juergen Haas
  */
-#include <ost/mol/mol.hh>
-#include <ost/message.hh>
-#include <ost/integrity_error.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include <ost/mol/mol.hh>
+#include <ost/message.hh>
+#include <ost/integrity_error.hh>
+
 using namespace ost;
 using namespace ost::mol;
 
diff --git a/modules/mol/base/tests/test_conn.cc b/modules/mol/base/tests/test_conn.cc
index e9c5bcfe10b2fd7196fbcd0c1f4ed5a178587bb0..be08f357a89b718027fbd4039d8719489b8cbbb5 100644
--- a/modules/mol/base/tests/test_conn.cc
+++ b/modules/mol/base/tests/test_conn.cc
@@ -19,10 +19,10 @@
 /*
  *  Authors: Marco Biasini, Juergen Haas
  */
-#include <ost/mol/mol.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
+#include <ost/mol/mol.hh>
 
 using namespace ost;
 using namespace ost::mol;
diff --git a/modules/mol/base/tests/test_delete.cc b/modules/mol/base/tests/test_delete.cc
index 20799d4ddff3c07b9cf5cd2d72dd55f828d340a0..2d5f2339ce7f6d0072d654840d3fed814e7301b1 100644
--- a/modules/mol/base/tests/test_delete.cc
+++ b/modules/mol/base/tests/test_delete.cc
@@ -19,11 +19,11 @@
 /*
  *  Authors: Marco Biasini, Juergen Haas
  */
-#include <ost/mol/mol.hh>
-#include <ost/log.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
+#include <ost/mol/mol.hh>
+#include <ost/log.hh>
 #include <ost/message.hh>
 #include <ost/geom/geom.hh>
 
diff --git a/modules/mol/base/tests/test_entity.cc b/modules/mol/base/tests/test_entity.cc
index 767b68bb3ba14f55eca9afde0a3158c5fcab06eb..89b6349bea4682f27d5f9aa148de7d3a1f63913f 100644
--- a/modules/mol/base/tests/test_entity.cc
+++ b/modules/mol/base/tests/test_entity.cc
@@ -20,14 +20,14 @@
  *  Authors: Marco Biasini, Juergen Haas
  */
  
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
 #include <ost/geom/vec_mat_predicates.hh>
 #include <ost/mol/chem_class.hh>
 #include <ost/mol/mol.hh>
 #include <ost/mol/property_id.hh>
 #include <cmath>
-#define BOOST_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
-#include <boost/test/auto_unit_test.hpp>
 
 #define CHECK_TRANSFORMED_ATOM_POSITION(ATOM,TARGET) \
    BOOST_CHECK(vec3_is_close(ATOM.GetPos(), TARGET,Real(0.1)))
diff --git a/modules/mol/base/tests/test_ics.cc b/modules/mol/base/tests/test_ics.cc
index c2285ee1b0464ce64e7372e041b760317b0a04fb..231df43cd79d7d4b8217a83eaa91f24b8213ed76 100644
--- a/modules/mol/base/tests/test_ics.cc
+++ b/modules/mol/base/tests/test_ics.cc
@@ -19,12 +19,12 @@
 /*
  *  Authors: Marco Biasini, Juergen Haas
  */
-#include <ost/mol/mol.hh>
-#include <ost/log.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/floating_point_comparison.hpp>
 #include <boost/test/auto_unit_test.hpp>
+#include <ost/mol/mol.hh>
+#include <ost/log.hh>
 #include <ost/message.hh>
 #include <ost/geom/geom.hh>
 
diff --git a/modules/mol/base/tests/test_iterators.cc b/modules/mol/base/tests/test_iterators.cc
index 829b15c96c218bb6630b013f9be1584edd48bc6c..47b24bb11f6f002dded9b8e3a15fbb2899d82898 100644
--- a/modules/mol/base/tests/test_iterators.cc
+++ b/modules/mol/base/tests/test_iterators.cc
@@ -19,11 +19,11 @@
 /*
  *  Authors: Marco Biasini, Juergen Haas
  */
-#include <ost/mol/mol.hh>
-#include <ost/message.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
+#include <ost/mol/mol.hh>
+#include <ost/message.hh>
 #include <iostream>
 
 using namespace ost;
diff --git a/modules/mol/base/tests/test_residue.cc b/modules/mol/base/tests/test_residue.cc
index 7dca39081915d4e7f49a29765a98920e4926ae00..89e8da33914110dc1d50150fb9dc19e2ab3dd50e 100644
--- a/modules/mol/base/tests/test_residue.cc
+++ b/modules/mol/base/tests/test_residue.cc
@@ -19,12 +19,12 @@
 /*
  *  Authors: Marco Biasini, Juergen Haas
  */
-#include <ost/mol/mol.hh>
-
-#include <ost/message.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
+#include <ost/mol/mol.hh>
+
+#include <ost/message.hh>
 
 
 using namespace ost;
diff --git a/modules/mol/base/tests/test_surface.cc b/modules/mol/base/tests/test_surface.cc
index 18ab12a8887993bad36afcc5fabe0df2a447f6b9..d48b79843a88f80ce5f69cdf957c5c05fd3a3492 100644
--- a/modules/mol/base/tests/test_surface.cc
+++ b/modules/mol/base/tests/test_surface.cc
@@ -17,12 +17,13 @@
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
  
-#include <ost/mol/surface_handle.hh>
-#include <cmath>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
+#include <ost/mol/surface_handle.hh>
+#include <cmath>
+
 using namespace ost;
 using namespace ost::mol;
 
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 9d47c8e0b1766050490d93e2765c1b57696195af..0c8f2c68098025afbdf45b95f433c59ec93945e7 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -18,7 +18,6 @@ if (NOT ENABLE_STATIC)
            TARGET ost_scripts)
     script(NAME ost.bat INPUT ost.bat.in SUBSTITUTE ${SUBST_DICT}
            TARGET ost_scripts)
-    script(NAME gipltng.bat INPUT gipltng.bat.in SUBSTITUTE ${SUBST_DICT})
   else()
     script(NAME ost_config INPUT ost_config.in SUBSTITUTE ${SUBST_DICT}
            TARGET ost_scripts OUTPUT_DIR ${LIBEXEC_PATH})
diff --git a/tools/molck/CMakeLists.txt b/tools/molck/CMakeLists.txt
index 346f3466a7f728d411b418968fab7f8ed94a7bca..4e1dc2fb79b73e90022dd2f546a5011c98eca118 100644
--- a/tools/molck/CMakeLists.txt
+++ b/tools/molck/CMakeLists.txt
@@ -1,3 +1,4 @@
-executable(NAME molck SOURCES main.cc 
+if (NOT WIN32)
+executable(NAME molck SOURCES main.cc
            DEPENDS_ON ost_io STATIC)
-
+endif(NOT WIN32)